
(function($) {
var _rootUrl = '/layout/set/dm2011_headforum/', _serverUrl = _rootUrl + 'ezjscore/', _seperator = '@SEPERATOR$';
if ( window.XMLHttpRequest && window.ActiveXObject )
$.ajaxSettings.xhr = function() { try { return new window.ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} };
function _ez( callArgs, post, callBack )
{
if(callBack == undefined){
callBack = post;
post={postData: 'hi!'};
}
callArgs = callArgs.join !== undefined ? callArgs.join( _seperator ) : callArgs;
var url = _serverUrl + 'call/';
if ( post )
{
if ( post.join !== undefined )
post.push( { 'name': 'ezjscServer_function_arguments', 'value': callArgs } );
else if ( typeof(post) === 'string' )
post += ( post !== '' ? '&' : '' ) + 'ezjscServer_function_arguments=' + callArgs;
else
post['ezjscServer_function_arguments'] = callArgs;
return $.post( url, post, callBack, 'json' );
}
return $.get( url + encodeURIComponent( callArgs ), {}, callBack, 'json' );
};
_ez.url = _serverUrl;
_ez.root_url = _rootUrl;
_ez.seperator = _seperator;
$.ez = _ez;
function _ezLoad( callArgs, post, selector, callBack )
{
callArgs = callArgs.join !== undefined ? callArgs.join( _seperator ) : callArgs;
var url = _serverUrl + 'call/';
if ( post )
post['ezjscServer_function_arguments'] = callArgs;
else
url += encodeURIComponent( callArgs );
return this.load( url + ( selector ? ' ' + selector : '' ), post, callBack );
};
$.fn.ez = _ezLoad;
})(jQuery);
jQuery.fn.accessNews = function( settings ) {
settings = jQuery.extend({
speed : "normal",
slideBy : 2
}, settings);
return this.each(function() {
jQuery.fn.accessNews.run( jQuery( this ), settings );
});
};
jQuery.fn.accessNews.run = function( $this, settings ) {
jQuery( ".javascript_css", $this ).css( "display", "none" );
var ul = jQuery( "ul:eq(0)", $this );
var li = ul.children();
if ( li.length > settings.slideBy ) {
var $next = jQuery( ".next > a", $this );
var $back = jQuery( ".back > a", $this );
var liWidth = jQuery( li[0] ).width();
var animating = false;
ul.css( "width", ( (li.length + 1) * liWidth ) );
$next.click(function() {
if ( !animating ) {
animating = true;
offsetLeft = parseInt( ul.css( "left" ) ) - ( 1 * liWidth );
if ( offsetLeft + ul.width() > 0 ) {
$back.css( "display", "block" );
ul.animate({
left: offsetLeft
}, settings.speed, function() {
if ( parseInt( ul.css( "left" ) ) + ul.width() <= (settings.slideBy + 1) * liWidth ) {
$next.css( "display", "none" );
}
animating = false;
});
} else {
animating = false;
}
}
return false;
});
$back.click(function() {
if ( !animating ) {
animating = true;
offsetRight = parseInt( ul.css( "left" ) ) + (1 *  liWidth );
if ( offsetRight + ul.width() <= ul.width() ) {
$next.css( "display", "block" );
ul.animate({
left: offsetRight
}, settings.speed, function() {
if ( parseInt( ul.css( "left" ) ) == 0 ) {
$back.css( "display", "none" );
}
animating = false;
});
} else {
animating = false;
}
}
return false;
});
$next.css( "display", "block" )
.parent().after( [ "<p class=\"view_all\">", settings.headline, " - ", li.length, " total ( <a href=\"#\">view all</a> )</p>" ].join( "" ) );
jQuery( ".view_all > a, .skip_to_news > a", $this ).click(function() {
var skip_to_news = ( jQuery( this ).html() == "Skip to News" );
if ( jQuery( this ).html() == "view all" || skip_to_news ) {
ul.css( "width", "auto" ).css( "left", "0" );
$next.css( "display", "none" );
$back.css( "display", "none" );
if ( !skip_to_news ) {
jQuery( this ).html( "view less" );
}
} else {
if ( !skip_to_news ) {
jQuery( this ).html( "view all" );
}
ul.css( "width", ( (li.length + 1) * liWidth ) );
$next.css( "display", "block" );
}
return false;
});
}
};
if (!document.myGetElementsByClassName) {
document.myGetElementsByClassName = function(className) {
var children = document.getElementsByTagName('*') || document.all;
var elements = new Array();
for (var i = 0; i < children.length; i++) {
var child = children[i];
var classNames = child.className.split(' ');
for (var j = 0; j < classNames.length; j++) {
if (classNames[j] == className) {
elements.push(child);
break;
}
}
}
return elements;
}
}
var Reflection = {
defaultHeight : 0.5,
defaultOpacity: 0.5,
add: function(image, options) {
Reflection.remove(image);
doptions = { "height" : Reflection.defaultHeight, "opacity" : Reflection.defaultOpacity }
if (options) {
for (var i in doptions) {
if (!options[i]) {
options[i] = doptions[i];
}
}
} else {
options = doptions;
}
try {
var d = document.createElement('div');
var p = image;
var classes = p.className.split(' ');
var newClasses = '';
for (j=0;j<classes.length;j++) {
if (classes[j] != "reflect") {
if (newClasses) {
newClasses += ' '
}
newClasses += classes[j];
}
}
var reflectionHeight = Math.floor(p.height*options['height']);
var divHeight = Math.floor(p.height*(1+options['height']));
var reflectionWidth = p.width;
if (document.all && !window.opera) {
if(p.parentElement.tagName == 'A') {
var d = document.createElement('a');
d.href = p.parentElement.href;
}
d.className = newClasses;
p.className = 'reflected';
d.style.cssText = p.style.cssText;
p.style.cssText = 'vertical-align: bottom';
var reflection = document.createElement('img');
reflection.src = p.src;
reflection.style.width = reflectionWidth+'px';
reflection.style.display = 'block';
reflection.style.height = p.height+"px";
reflection.style.marginBottom = "-"+(p.height-reflectionHeight)+'px';
reflection.style.filter = 'flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+(options['opacity']*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+(options['height']*100)+')';
d.style.width = reflectionWidth+'px';
d.style.height = divHeight+'px';
p.parentNode.replaceChild(d, p);
d.appendChild(p);
d.appendChild(reflection);
} else {
var canvas = document.createElement('canvas');
if (canvas.getContext) {
d.className = newClasses;
p.className = 'reflected';
d.style.cssText = p.style.cssText;
p.style.cssText = 'vertical-align: bottom';
var context = canvas.getContext("2d");
canvas.style.height = reflectionHeight+'px';
canvas.style.width = reflectionWidth+'px';
canvas.height = reflectionHeight;
canvas.width = reflectionWidth;
d.style.width = reflectionWidth+'px';
d.style.height = divHeight+'px';
p.parentNode.replaceChild(d, p);
d.appendChild(p);
d.appendChild(canvas);
context.save();
context.translate(0,image.height-1);
context.scale(1,-1);
context.drawImage(image, 0, 0, reflectionWidth, image.height);
context.restore();
context.globalCompositeOperation = "destination-out";
var gradient = context.createLinearGradient(0, 0, 0, reflectionHeight);
gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)");
gradient.addColorStop(0, "rgba(255, 255, 255, "+(1-options['opacity'])+")");
context.fillStyle = gradient;
context.rect(0, 0, reflectionWidth, reflectionHeight*2);
context.fill();
}
}
} catch (e) {
}
},
remove : function(image) {
if (image.className == "reflected") {
image.className = image.parentNode.className;
image.parentNode.parentNode.replaceChild(image, image.parentNode);
}
}
}
function addReflections() {
var rimages = document.myGetElementsByClassName('reflect');
for (i=0;i<rimages.length;i++) {
var rheight = null;
var ropacity = null;
var classes = rimages[i].className.split(' ');
for (j=0;j<classes.length;j++) {
if (classes[j].indexOf("rheight") == 0) {
var rheight = classes[j].substring(7)/100;
} else if (classes[j].indexOf("ropacity") == 0) {
var ropacity = classes[j].substring(8)/100;
}
}
Reflection.add(rimages[i], { height: rheight, opacity : ropacity});
}
}
var previousOnload = window.onload;
window.onload = function () { if(previousOnload) previousOnload(); addReflections(); }
jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
while(x<c.length){var m=r.exec(c.substr(x));
if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
}else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;},
URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;
while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){b=parseInt(m[1].substr(1),16);
t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}
});
(function($) {
var defaults = {
vertical: false,
rtl: false,
start: 1,
offset: 1,
size: null,
scroll: 3,
visible: null,
animation: 'normal',
easing: 'swing',
auto: 0,
wrap: null,
initCallback: null,
reloadCallback: null,
itemLoadCallback: null,
itemFirstInCallback: null,
itemFirstOutCallback: null,
itemLastInCallback: null,
itemLastOutCallback: null,
itemVisibleInCallback: null,
itemVisibleOutCallback: null,
buttonNextHTML: '<div></div>',
buttonPrevHTML: '<div></div>',
buttonNextEvent: 'click',
buttonPrevEvent: 'click',
buttonNextCallback: null,
buttonPrevCallback: null,
itemFallbackDimension: null
}, windowLoaded = false;
$(window).bind('load.jcarousel', function() { windowLoaded = true; });
$.jcarousel = function(e, o) {
this.options    = $.extend({}, defaults, o || {});
this.locked          = false;
this.autoStopped     = false;
this.container       = null;
this.clip            = null;
this.list            = null;
this.buttonNext      = null;
this.buttonPrev      = null;
this.buttonNextState = null;
this.buttonPrevState = null;
if (!o || o.rtl === undefined) {
this.options.rtl = ($(e).attr('dir') || $('html').attr('dir') || '').toLowerCase() == 'rtl';
}
this.wh = !this.options.vertical ? 'width' : 'height';
this.lt = !this.options.vertical ? (this.options.rtl ? 'right' : 'left') : 'top';
var skin = '', split = e.className.split(' ');
for (var i = 0; i < split.length; i++) {
if (split[i].indexOf('jcarousel-skin') != -1) {
$(e).removeClass(split[i]);
skin = split[i];
break;
}
}
if (e.nodeName.toUpperCase() == 'UL' || e.nodeName.toUpperCase() == 'OL') {
this.list = $(e);
this.container = this.list.parent();
if (this.container.hasClass('jcarousel-clip')) {
if (!this.container.parent().hasClass('jcarousel-container')) {
this.container = this.container.wrap('<div></div>');
}
this.container = this.container.parent();
} else if (!this.container.hasClass('jcarousel-container')) {
this.container = this.list.wrap('<div></div>').parent();
}
} else {
this.container = $(e);
this.list = this.container.find('ul,ol').eq(0);
}
if (skin !== '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1) {
this.container.wrap('<div class=" '+ skin + '"></div>');
}
this.clip = this.list.parent();
if (!this.clip.length || !this.clip.hasClass('jcarousel-clip')) {
this.clip = this.list.wrap('<div></div>').parent();
}
this.buttonNext = $('.jcarousel-next', this.container);
if (this.buttonNext.size() === 0 && this.options.buttonNextHTML !== null) {
this.buttonNext = this.clip.after(this.options.buttonNextHTML).next();
}
this.buttonNext.addClass(this.className('jcarousel-next'));
this.buttonPrev = $('.jcarousel-prev', this.container);
if (this.buttonPrev.size() === 0 && this.options.buttonPrevHTML !== null) {
this.buttonPrev = this.clip.after(this.options.buttonPrevHTML).next();
}
this.buttonPrev.addClass(this.className('jcarousel-prev'));
this.clip.addClass(this.className('jcarousel-clip')).css({
overflow: 'hidden',
position: 'relative'
});
this.list.addClass(this.className('jcarousel-list')).css({
overflow: 'hidden',
position: 'relative',
top: 0,
margin: 0,
padding: 0
}).css((this.options.rtl ? 'right' : 'left'), 0);
this.container.addClass(this.className('jcarousel-container')).css({
position: 'relative'
});
if (!this.options.vertical && this.options.rtl) {
this.container.addClass('jcarousel-direction-rtl').attr('dir', 'rtl');
}
var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null;
var li = this.list.children('li');
var self = this;
if (li.size() > 0) {
var wh = 0, j = this.options.offset;
li.each(function() {
self.format(this, j++);
wh += self.dimension(this, di);
});
this.list.css(this.wh, (wh + 100) + 'px');
if (!o || o.size === undefined) {
this.options.size = li.size();
}
}
this.container.css('display', 'block');
this.buttonNext.css('display', 'block');
this.buttonPrev.css('display', 'block');
this.funcNext   = function() { self.next(); };
this.funcPrev   = function() { self.prev(); };
this.funcResize = function() { self.reload(); };
if (this.options.initCallback !== null) {
this.options.initCallback(this, 'init');
}
if (!windowLoaded && $.browser.safari) {
this.buttons(false, false);
$(window).bind('load.jcarousel', function() { self.setup(); });
} else {
this.setup();
}
};
var $jc = $.jcarousel;
$jc.fn = $jc.prototype = {
jcarousel: '0.2.7'
};
$jc.fn.extend = $jc.extend = $.extend;
$jc.fn.extend({
setup: function() {
this.first     = null;
this.last      = null;
this.prevFirst = null;
this.prevLast  = null;
this.animating = false;
this.timer     = null;
this.tail      = null;
this.inTail    = false;
if (this.locked) {
return;
}
this.list.css(this.lt, this.pos(this.options.offset) + 'px');
var p = this.pos(this.options.start, true);
this.prevFirst = this.prevLast = null;
this.animate(p, false);
$(window).unbind('resize.jcarousel', this.funcResize).bind('resize.jcarousel', this.funcResize);
},
reset: function() {
this.list.empty();
this.list.css(this.lt, '0px');
this.list.css(this.wh, '10px');
if (this.options.initCallback !== null) {
this.options.initCallback(this, 'reset');
}
this.setup();
},
reload: function() {
if (this.tail !== null && this.inTail) {
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);
}
this.tail   = null;
this.inTail = false;
if (this.options.reloadCallback !== null) {
this.options.reloadCallback(this);
}
if (this.options.visible !== null) {
var self = this;
var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
this.list.children('li').each(function(i) {
wh += self.dimension(this, di);
if (i + 1 < self.first) {
lt = wh;
}
});
this.list.css(this.wh, wh + 'px');
this.list.css(this.lt, -lt + 'px');
}
this.scroll(this.first, false);
},
lock: function() {
this.locked = true;
this.buttons();
},
unlock: function() {
this.locked = false;
this.buttons();
},
size: function(s) {
if (s !== undefined) {
this.options.size = s;
if (!this.locked) {
this.buttons();
}
}
return this.options.size;
},
has: function(i, i2) {
if (i2 === undefined || !i2) {
i2 = i;
}
if (this.options.size !== null && i2 > this.options.size) {
i2 = this.options.size;
}
for (var j = i; j <= i2; j++) {
var e = this.get(j);
if (!e.length || e.hasClass('jcarousel-item-placeholder')) {
return false;
}
}
return true;
},
get: function(i) {
return $('.jcarousel-item-' + i, this.list);
},
add: function(i, s) {
var e = this.get(i), old = 0, n = $(s);
if (e.length === 0) {
var c, j = $jc.intval(i);
e = this.create(i);
while (true) {
c = this.get(--j);
if (j <= 0 || c.length) {
if (j <= 0) {
this.list.prepend(e);
} else {
c.after(e);
}
break;
}
}
} else {
old = this.dimension(e);
}
if (n.get(0).nodeName.toUpperCase() == 'LI') {
e.replaceWith(n);
e = n;
} else {
e.empty().append(s);
}
this.format(e.removeClass(this.className('jcarousel-item-placeholder')), i);
var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null;
var wh = this.dimension(e, di) - old;
if (i > 0 && i < this.first) {
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px');
}
this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');
return e;
},
remove: function(i) {
var e = this.get(i);
if (!e.length || (i >= this.first && i <= this.last)) {
return;
}
var d = this.dimension(e);
if (i < this.first) {
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');
}
e.remove();
this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
},
next: function() {
if (this.tail !== null && !this.inTail) {
this.scrollTail(false);
} else {
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size !== null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
}
},
prev: function() {
if (this.tail !== null && this.inTail) {
this.scrollTail(true);
} else {
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size !== null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
}
},
scrollTail: function(b) {
if (this.locked || this.animating || !this.tail) {
return;
}
this.pauseAuto();
var pos  = $jc.intval(this.list.css(this.lt));
pos = !b ? pos - this.tail : pos + this.tail;
this.inTail = !b;
this.prevFirst = this.first;
this.prevLast  = this.last;
this.animate(pos);
},
scroll: function(i, a) {
if (this.locked || this.animating) {
return;
}
this.pauseAuto();
this.animate(this.pos(i), a);
},
pos: function(i, fv) {
var pos  = $jc.intval(this.list.css(this.lt));
if (this.locked || this.animating) {
return pos;
}
if (this.options.wrap != 'circular') {
i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);
}
var back = this.first > i;
var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
var c = back ? this.get(f) : this.get(this.last);
var j = back ? f : f - 1;
var e = null, l = 0, p = false, d = 0, g;
while (back ? --j >= i : ++j < i) {
e = this.get(j);
p = !e.length;
if (e.length === 0) {
e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
c[back ? 'before' : 'after' ](e);
if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
g = this.get(this.index(j));
if (g.length) {
e = this.add(j, g.clone(true));
}
}
}
c = e;
d = this.dimension(e);
if (p) {
l += d;
}
if (this.first !== null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size === null || j <= this.options.size)))) {
pos = back ? pos + d : pos - d;
}
}
var clipping = this.clipping(), cache = [], visible = 0, v = 0;
c = this.get(i - 1);
j = i;
while (++visible) {
e = this.get(j);
p = !e.length;
if (e.length === 0) {
e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
if (c.length === 0) {
this.list.prepend(e);
} else {
c[back ? 'before' : 'after' ](e);
}
if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
g = this.get(this.index(j));
if (g.length) {
e = this.add(j, g.clone(true));
}
}
}
c = e;
d = this.dimension(e);
if (d === 0) {
throw new Error('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
}
if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size) {
cache.push(e);
} else if (p) {
l += d;
}
v += d;
if (v >= clipping) {
break;
}
j++;
}
for (var x = 0; x < cache.length; x++) {
cache[x].remove();
}
if (l > 0) {
this.list.css(this.wh, this.dimension(this.list) + l + 'px');
if (back) {
pos -= l;
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
}
}
var last = i + visible - 1;
if (this.options.wrap != 'circular' && this.options.size && last > this.options.size) {
last = this.options.size;
}
if (j > last) {
visible = 0;
j = last;
v = 0;
while (++visible) {
e = this.get(j--);
if (!e.length) {
break;
}
v += this.dimension(e);
if (v >= clipping) {
break;
}
}
}
var first = last - visible + 1;
if (this.options.wrap != 'circular' && first < 1) {
first = 1;
}
if (this.inTail && back) {
pos += this.tail;
this.inTail = false;
}
this.tail = null;
if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
if ((v - m) > clipping) {
this.tail = v - clipping - m;
}
}
if (fv && i === this.options.size && this.tail) {
pos -= this.tail;
this.inTail = true;
}
while (i-- > first) {
pos += this.dimension(this.get(i));
}
this.prevFirst = this.first;
this.prevLast  = this.last;
this.first     = first;
this.last      = last;
return pos;
},
animate: function(p, a) {
if (this.locked || this.animating) {
return;
}
this.animating = true;
var self = this;
var scrolled = function() {
self.animating = false;
if (p === 0) {
self.list.css(self.lt,  0);
}
if (!self.autoStopped && (self.options.wrap == 'circular' || self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size === null || self.last < self.options.size || (self.last == self.options.size && self.tail !== null && !self.inTail))) {
self.startAuto();
}
self.buttons();
self.notify('onAfterAnimation');
if (self.options.wrap == 'circular' && self.options.size !== null) {
for (var i = self.prevFirst; i <= self.prevLast; i++) {
if (i !== null && !(i >= self.first && i <= self.last) && (i < 1 || i > self.options.size)) {
self.remove(i);
}
}
}
};
this.notify('onBeforeAnimation');
if (!this.options.animation || a === false) {
this.list.css(this.lt, p + 'px');
scrolled();
} else {
var o = !this.options.vertical ? (this.options.rtl ? {'right': p} : {'left': p}) : {'top': p};
this.list.animate(o, this.options.animation, this.options.easing, scrolled);
}
},
startAuto: function(s) {
if (s !== undefined) {
this.options.auto = s;
}
if (this.options.auto === 0) {
return this.stopAuto();
}
if (this.timer !== null) {
return;
}
this.autoStopped = false;
var self = this;
this.timer = window.setTimeout(function() { self.next(); }, this.options.auto * 1000);
},
stopAuto: function() {
this.pauseAuto();
this.autoStopped = true;
},
pauseAuto: function() {
if (this.timer === null) {
return;
}
window.clearTimeout(this.timer);
this.timer = null;
},
buttons: function(n, p) {
if (n == null) {
n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size === null || this.last < this.options.size);
if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size !== null && this.last >= this.options.size) {
n = this.tail !== null && !this.inTail;
}
}
if (p == null) {
p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size !== null && this.first == 1) {
p = this.tail !== null && this.inTail;
}
}
var self = this;
if (this.buttonNext.size() > 0) {
this.buttonNext.unbind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);
if (n) {
this.buttonNext.bind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);
}
this.buttonNext[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
if (this.options.buttonNextCallback !== null && this.buttonNext.data('jcarouselstate') != n) {
this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); }).data('jcarouselstate', n);
}
} else {
if (this.options.buttonNextCallback !== null && this.buttonNextState != n) {
this.options.buttonNextCallback(self, null, n);
}
}
if (this.buttonPrev.size() > 0) {
this.buttonPrev.unbind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);
if (p) {
this.buttonPrev.bind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);
}
this.buttonPrev[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);
if (this.options.buttonPrevCallback !== null && this.buttonPrev.data('jcarouselstate') != p) {
this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); }).data('jcarouselstate', p);
}
} else {
if (this.options.buttonPrevCallback !== null && this.buttonPrevState != p) {
this.options.buttonPrevCallback(self, null, p);
}
}
this.buttonNextState = n;
this.buttonPrevState = p;
},
notify: function(evt) {
var state = this.prevFirst === null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');
this.callback('itemLoadCallback', evt, state);
if (this.prevFirst !== this.first) {
this.callback('itemFirstInCallback', evt, state, this.first);
this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
}
if (this.prevLast !== this.last) {
this.callback('itemLastInCallback', evt, state, this.last);
this.callback('itemLastOutCallback', evt, state, this.prevLast);
}
this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
},
callback: function(cb, evt, state, i1, i2, i3, i4) {
if (this.options[cb] == null || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation')) {
return;
}
var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];
if (!$.isFunction(callback)) {
return;
}
var self = this;
if (i1 === undefined) {
callback(self, state, evt);
} else if (i2 === undefined) {
this.get(i1).each(function() { callback(self, this, i1, state, evt); });
} else {
var call = function(i) {
self.get(i).each(function() { callback(self, this, i, state, evt); });
};
for (var i = i1; i <= i2; i++) {
if (i !== null && !(i >= i3 && i <= i4)) {
call(i);
}
}
}
},
create: function(i) {
return this.format('<li></li>', i);
},
format: function(e, i) {
e = $(e);
var split = e.get(0).className.split(' ');
for (var j = 0; j < split.length; j++) {
if (split[j].indexOf('jcarousel-') != -1) {
e.removeClass(split[j]);
}
}
e.addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i)).css({
'float': (this.options.rtl ? 'right' : 'left'),
'list-style': 'none'
}).attr('jcarouselindex', i);
return e;
},
className: function(c) {
return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
},
dimension: function(e, d) {
var el = e.jquery !== undefined ? e[0] : e;
var old = !this.options.vertical ?
(el.offsetWidth || $jc.intval(this.options.itemFallbackDimension)) + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
(el.offsetHeight || $jc.intval(this.options.itemFallbackDimension)) + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');
if (d == null || old == d) {
return old;
}
var w = !this.options.vertical ?
d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');
$(el).css(this.wh, w + 'px');
return this.dimension(el);
},
clipping: function() {
return !this.options.vertical ?
this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
},
index: function(i, s) {
if (s == null) {
s = this.options.size;
}
return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
}
});
$jc.extend({
defaults: function(d) {
return $.extend(defaults, d || {});
},
margin: function(e, p) {
if (!e) {
return 0;
}
var el = e.jquery !== undefined ? e[0] : e;
if (p == 'marginRight' && $.browser.safari) {
var old = {'display': 'block', 'float': 'none', 'width': 'auto'}, oWidth, oWidth2;
$.swap(el, old, function() { oWidth = el.offsetWidth; });
old.marginRight = 0;
$.swap(el, old, function() { oWidth2 = el.offsetWidth; });
return oWidth2 - oWidth;
}
return $jc.intval($.css(el, p));
},
intval: function(v) {
v = parseInt(v, 10);
return isNaN(v) ? 0 : v;
}
});
$.fn.jcarousel = function(o) {
if (typeof o == 'string') {
var instance = $(this).data('jcarousel'), args = Array.prototype.slice.call(arguments, 1);
return instance[o].apply(instance, args);
} else {
return this.each(function() {
$(this).data('jcarousel', new $jc(this, o));
});
}
};
})(jQuery);
(function($) {
$.fn.fixPNG = function() {
return this.each(function () {
var image = $(this).css('backgroundImage');
if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
image = RegExp.$1;
$(this).css({
'backgroundImage': 'none',
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=" + ($(this).css('backgroundRepeat') == 'no-repeat' ? 'crop' : 'scale') + ", src='" + image + "')"
}).each(function () {
var position = $(this).css('position');
if (position != 'absolute' && position != 'relative')
$(this).css('position', 'relative');
});
}
});
};
var elem, opts, busy = false, imagePreloader = new Image, loadingTimer, loadingFrame = 1, imageRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i;
var ieQuirks = null, IE6 = $.browser.msie && $.browser.version.substr(0,1) == 6 && !window.XMLHttpRequest, oldIE = IE6 || ($.browser.msie && $.browser.version.substr(0,1) == 7);
$.fn.fancybox = function(o) {
var settings		= $.extend({}, $.fn.fancybox.defaults, o);
var matchedGroup	= this;
function _initialize() {
elem = this;
opts = $.extend({}, settings);
_start();
return false;
};
function _start() {
if (busy) return;
if ($.isFunction(opts.callbackOnStart)) {
opts.callbackOnStart();
}
opts.itemArray		= [];
opts.itemCurrent	= 0;
if (settings.itemArray.length > 0) {
opts.itemArray = settings.itemArray;
} else {
var item = {};
if (!elem.rel || elem.rel == '') {
var item = {href: elem.href, title: elem.title};
if ($(elem).children("img:first").length) {
item.orig = $(elem).children("img:first");
} else {
item.orig = $(elem);
}
if (item.title == '' || typeof item.title == 'undefined') {
item.title = item.orig.attr('alt');
}
opts.itemArray.push( item );
} else {
var subGroup = $(matchedGroup).filter("a[rel=" + elem.rel + "]");
var item = {};
for (var i = 0; i < subGroup.length; i++) {
item = {href: subGroup[i].href, title: subGroup[i].title};
if ($(subGroup[i]).children("img:first").length) {
item.orig = $(subGroup[i]).children("img:first");
} else {
item.orig = $(subGroup[i]);
}
if (item.title == '' || typeof item.title == 'undefined') {
item.title = item.orig.attr('alt');
}
opts.itemArray.push( item );
}
}
}
while ( opts.itemArray[ opts.itemCurrent ].href != elem.href ) {
opts.itemCurrent++;
}
if (opts.overlayShow) {
if (IE6) {
$('embed, object, select').css('visibility', 'hidden');
$("#fancy_overlay").css('height', $(document).height());
}
$("#fancy_overlay").css({
'background-color'	: opts.overlayColor,
'opacity'			: opts.overlayOpacity
}).show();
}
$(window).bind("resize.fb scroll.fb", $.fn.fancybox.scrollBox);
_change_item();
};
function _change_item() {
$("#fancy_right, #fancy_left, #fancy_close, #fancy_title").hide();
var href = opts.itemArray[ opts.itemCurrent ].href;
if (href.match("iframe") || elem.className.indexOf("iframe") >= 0) {
$.fn.fancybox.showLoading();
_set_content('<iframe id="fancy_frame" onload="jQuery.fn.fancybox.showIframe()" name="fancy_iframe' + Math.round(Math.random()*1000) + '" frameborder="0" hspace="0" src="' + href + '"></iframe>', opts.frameWidth, opts.frameHeight);
} else if (href.match(/#/)) {
var target = window.location.href.split('#')[0]; target = href.replace(target, ''); target = target.substr(target.indexOf('#'));
_set_content('<div id="fancy_div">' + $(target).html() + '</div>', opts.frameWidth, opts.frameHeight);
} else if (href.match(imageRegExp)) {
imagePreloader = new Image; imagePreloader.src = href;
if (imagePreloader.complete) {
_proceed_image();
} else {
$.fn.fancybox.showLoading();
$(imagePreloader).unbind().bind('load', function() {
$("#fancy_loading").hide();
_proceed_image();
});
}
} else {
$.fn.fancybox.showLoading();
$.get(href, function(data) {
$("#fancy_loading").hide();
_set_content( '<div id="fancy_ajax">' + data + '</div>', opts.frameWidth, opts.frameHeight );
});
}
};
function _proceed_image() {
var width	= imagePreloader.width;
var height	= imagePreloader.height;
var horizontal_space	= (opts.padding * 2) + 40;
var vertical_space		= (opts.padding * 2) + 60;
var w = $.fn.fancybox.getViewport();
if (opts.imageScale && (width > (w[0] - horizontal_space) || height > (w[1] - vertical_space))) {
var ratio = Math.min(Math.min(w[0] - horizontal_space, width) / width, Math.min(w[1] - vertical_space, height) / height);
width	= Math.round(ratio * width);
height	= Math.round(ratio * height);
}
_set_content('<img alt="" id="fancy_img" src="' + imagePreloader.src + '" />', width, height);
};
function _preload_neighbor_images() {
if ((opts.itemArray.length -1) > opts.itemCurrent) {
var href = opts.itemArray[opts.itemCurrent + 1].href || false;
if (href && href.match(imageRegExp)) {
objNext = new Image();
objNext.src = href;
}
}
if (opts.itemCurrent > 0) {
var href = opts.itemArray[opts.itemCurrent -1].href || false;
if (href && href.match(imageRegExp)) {
objNext = new Image();
objNext.src = href;
}
}
};
function _set_content(value, width, height) {
busy = true;
var pad = opts.padding;
if (oldIE || ieQuirks) {
$("#fancy_content")[0].style.removeExpression("height");
$("#fancy_content")[0].style.removeExpression("width");
}
if (pad > 0) {
width	+= pad * 2;
height	+= pad * 2;
$("#fancy_content").css({
'top'		: pad + 'px',
'right'		: pad + 'px',
'bottom'	: pad + 'px',
'left'		: pad + 'px',
'width'		: 'auto',
'height'	: 'auto'
});
if (oldIE || ieQuirks) {
$("#fancy_content")[0].style.setExpression('height',	'(this.parentNode.clientHeight - '	+ pad * 2 + ')');
$("#fancy_content")[0].style.setExpression('width',		'(this.parentNode.clientWidth - '	+ pad * 2 + ')');
}
} else {
$("#fancy_content").css({
'top'		: 0,
'right'		: 0,
'bottom'	: 0,
'left'		: 0,
'width'		: '100%',
'height'	: '100%'
});
}
if ($("#fancy_outer").is(":visible") && width == $("#fancy_outer").width() && height == $("#fancy_outer").height()) {
$("#fancy_content").fadeOut('fast', function() {
$("#fancy_content").empty().append($(value)).fadeIn("normal", function() {
_finish();
});
});
return;
}
var w = $.fn.fancybox.getViewport();
var itemTop		= (height	+ 60) > w[1] ? w[3] : (w[3] + Math.round((w[1] - height	- 60) * 0.5));
var itemLeft	= (width	+ 40) > w[0] ? w[2] : (w[2] + Math.round((w[0] - width	- 40) * 0.5));
var itemOpts = {
'left':		itemLeft,
'top':		itemTop,
'width':	width + 'px',
'height':	height + 'px'
};
if ($("#fancy_outer").is(":visible")) {
$("#fancy_content").fadeOut("normal", function() {
$("#fancy_content").empty();
$("#fancy_outer").animate(itemOpts, opts.zoomSpeedChange, opts.easingChange, function() {
$("#fancy_content").append($(value)).fadeIn("normal", function() {
_finish();
});
});
});
} else {
if (opts.zoomSpeedIn > 0 && opts.itemArray[opts.itemCurrent].orig !== undefined) {
$("#fancy_content").empty().append($(value));
var orig_item	= opts.itemArray[opts.itemCurrent].orig;
var orig_pos	= $.fn.fancybox.getPosition(orig_item);
$("#fancy_outer").css({
'left':		(orig_pos.left	- 20 - opts.padding) + 'px',
'top':		(orig_pos.top	- 20 - opts.padding) + 'px',
'width':	$(orig_item).width() + (opts.padding * 2),
'height':	$(orig_item).height() + (opts.padding * 2)
});
if (opts.zoomOpacity) {
itemOpts.opacity = 'show';
}
$("#fancy_outer").animate(itemOpts, opts.zoomSpeedIn, opts.easingIn, function() {
_finish();
});
} else {
$("#fancy_content").hide().empty().append($(value)).show();
$("#fancy_outer").css(itemOpts).fadeIn("normal", function() {
_finish();
});
}
}
};
function _set_navigation() {
if (opts.itemCurrent !== 0) {
$("#fancy_left, #fancy_left_ico").unbind().bind("click", function(e) {
e.stopPropagation();
opts.itemCurrent--;
_change_item();
return false;
});
$("#fancy_left").show();
}
if (opts.itemCurrent != ( opts.itemArray.length -1)) {
$("#fancy_right, #fancy_right_ico").unbind().bind("click", function(e) {
e.stopPropagation();
opts.itemCurrent++;
_change_item();
return false;
});
$("#fancy_right").show();
}
};
function _finish() {
if ($.browser.msie) {
$("#fancy_content")[0].style.removeAttribute('filter');
$("#fancy_outer")[0].style.removeAttribute('filter');
}
_set_navigation();
_preload_neighbor_images();
$(document).bind("keydown.fb", function(e) {
if (e.keyCode == 27 && opts.enableEscapeButton) {
$.fn.fancybox.close();
} else if(e.keyCode == 37 && opts.itemCurrent !== 0) {
$(document).unbind("keydown.fb");
opts.itemCurrent--;
_change_item();
} else if(e.keyCode == 39 && opts.itemCurrent != (opts.itemArray.length - 1)) {
$(document).unbind("keydown.fb");
opts.itemCurrent++;
_change_item();
}
});
if (opts.hideOnContentClick) {
$("#fancy_content").click($.fn.fancybox.close);
}
if (opts.overlayShow && opts.hideOnOverlayClick) {
$("#fancy_overlay").bind("click", $.fn.fancybox.close);
}
if (opts.showCloseButton) {
$("#fancy_close").bind("click", $.fn.fancybox.close).show();
}
if (typeof opts.itemArray[ opts.itemCurrent ].title !== 'undefined' && opts.itemArray[ opts.itemCurrent ].title.length > 0) {
var pos = $("#fancy_outer").position();
$('#fancy_title div').html("&nbsp;");
$('#fancy_title').css({
'top'	: pos.top + $("#fancy_inner").outerHeight() + 20,
'width'	: $("#fancy_inner").outerWidth(),
'left'	: pos.left + 20
}).show();
}
if (opts.overlayShow && IE6) {
$('embed, object, select', $('#fancy_content')).css('visibility', 'visible');
}
if ($.isFunction(opts.callbackOnShow)) {
opts.callbackOnShow( opts.itemArray[ opts.itemCurrent ] );
}
if ($.browser.msie) {
$("#fancy_outer")[0].style.removeAttribute('filter');
$("#fancy_content")[0].style.removeAttribute('filter');
}
busy = false;
};
return this.unbind('click.fb').bind('click.fb', _initialize);
};
$.fn.fancybox.scrollBox = function() {
var w = $.fn.fancybox.getViewport();
if (opts.centerOnScroll && $("#fancy_outer").is(':visible')) {
var ow	= $("#fancy_outer").outerWidth();
var oh	= $("#fancy_outer").outerHeight();
var pos	= {
'top'	: (oh > w[1] ? w[3] : w[3] + Math.round((w[1] - oh) * 0.5)),
'left'	: (ow > w[0] ? w[2] : w[2] + Math.round((w[0] - ow) * 0.5))
};
$("#fancy_outer").css(pos);
$('#fancy_title').css({
'top'	: pos.top + $("#fancy_inner").outerHeight() + 20,
'left'	: pos.left + 20
});
}
if (IE6 && $("#fancy_overlay").is(':visible')) {
$("#fancy_overlay").css({
'height' : $(document).height()
});
}
if ($("#fancy_loading").is(':visible')) {
$("#fancy_loading").css({'left': ((w[0] - 40) * 0.5 + w[2]), 'top': ((w[1] - 40) * 0.5 + w[3])});
}
};
$.fn.fancybox.getNumeric = function(el, prop) {
return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
};
$.fn.fancybox.getPosition = function(el) {
var pos = el.offset();
pos.top	+= $.fn.fancybox.getNumeric(el, 'paddingTop');
pos.top	+= $.fn.fancybox.getNumeric(el, 'borderTopWidth');
pos.left += $.fn.fancybox.getNumeric(el, 'paddingLeft');
pos.left += $.fn.fancybox.getNumeric(el, 'borderLeftWidth');
return pos;
};
$.fn.fancybox.showIframe = function() {
$("#fancy_loading").hide();
$("#fancy_frame").show();
};
$.fn.fancybox.getViewport = function() {
return [$(window).width(), $(window).height(), $(document).scrollLeft(), $(document).scrollTop() ];
};
$.fn.fancybox.animateLoading = function() {
if (!$("#fancy_loading").is(':visible')){
clearInterval(loadingTimer);
return;
}
$("#fancy_loading > div").css('top', (loadingFrame * -40) + 'px');
loadingFrame = (loadingFrame + 1) % 12;
};
$.fn.fancybox.showLoading = function() {
clearInterval(loadingTimer);
var w = $.fn.fancybox.getViewport();
$("#fancy_loading").css({'left': ((w[0] - 40) * 0.5 + w[2]), 'top': ((w[1] - 40) * 0.5 + w[3])}).show();
$("#fancy_loading").bind('click', $.fn.fancybox.close);
loadingTimer = setInterval($.fn.fancybox.animateLoading, 66);
};
$.fn.fancybox.close = function() {
busy = true;
$(imagePreloader).unbind();
$(document).unbind("keydown.fb");
$(window).unbind("resize.fb scroll.fb");
$("#fancy_overlay, #fancy_content, #fancy_close").unbind();
$("#fancy_close, #fancy_loading, #fancy_left, #fancy_right, #fancy_title").hide();
__cleanup = function() {
if ($("#fancy_overlay").is(':visible')) {
$("#fancy_overlay").fadeOut("fast");
}
$("#fancy_content").empty();
if (opts.centerOnScroll) {
$(window).unbind("resize.fb scroll.fb");
}
if (IE6) {
$('embed, object, select').css('visibility', 'visible');
}
if ($.isFunction(opts.callbackOnClose)) {
opts.callbackOnClose();
}
busy = false;
};
if ($("#fancy_outer").is(":visible") !== false) {
if (opts.zoomSpeedOut > 0 && opts.itemArray[opts.itemCurrent].orig !== undefined) {
var orig_item	= opts.itemArray[opts.itemCurrent].orig;
var orig_pos	= $.fn.fancybox.getPosition(orig_item);
var itemOpts = {
'left':		(orig_pos.left	- 20 - opts.padding) + 'px',
'top': 		(orig_pos.top	- 20 - opts.padding) + 'px',
'width':	$(orig_item).width() + (opts.padding * 2),
'height':	$(orig_item).height() + (opts.padding * 2)
};
if (opts.zoomOpacity) {
itemOpts.opacity = 'hide';
}
$("#fancy_outer").stop(false, true).animate(itemOpts, opts.zoomSpeedOut, opts.easingOut, __cleanup);
} else {
$("#fancy_outer").stop(false, true).fadeOut('fast', __cleanup);
}
} else {
__cleanup();
}
return false;
};
$.fn.fancybox.build = function() {
var html = '';
html += '<div id="fancy_overlay"></div>';
html += '<div id="fancy_loading"><div></div></div>';
html += '<div id="fancy_outer">';
html += '<div id="fancy_inner">';
html += '<div id="fancy_close">chiudi</div>';
html += '<div id="fancy_bg"><div class="fancy_bg" id="fancy_bg_n"></div><div class="fancy_bg" id="fancy_bg_ne"></div><div class="fancy_bg" id="fancy_bg_e"></div><div class="fancy_bg" id="fancy_bg_se"></div><div class="fancy_bg" id="fancy_bg_s"></div><div class="fancy_bg" id="fancy_bg_sw"></div><div class="fancy_bg" id="fancy_bg_w"></div><div class="fancy_bg" id="fancy_bg_nw"></div></div>';
html += '<a href="javascript:;" id="fancy_left"><span class="fancy_ico" id="fancy_left_ico"></span></a><a href="javascript:;" id="fancy_right"><span class="fancy_ico" id="fancy_right_ico"></span></a>';
html += '<div id="fancy_content"></div>';
html += '</div>';
html += '</div>';
html += '<div id="fancy_title"></div>';
$(html).appendTo("body");
$('<div class="fancy_title" id="fancy_title_main"></div>').appendTo('#fancy_title');
if ($.browser.msie) {
$(".fancy_bg").fixPNG();
}
if (IE6) {
$("div#fancy_overlay").css("position", "absolute");
$("#fancy_loading div, #fancy_close, .fancy_title, .fancy_ico").fixPNG();
$("#fancy_inner").prepend('<iframe id="fancy_bigIframe" src="javascript:false;" scrolling="no" frameborder="0"></iframe>');
var frameDoc = $('#fancy_bigIframe')[0].contentWindow.document;
frameDoc.open();
frameDoc.close();
}
};
$.fn.fancybox.defaults = {
padding				:	10,
imageScale			:	true,
zoomOpacity			:	true,
zoomSpeedIn			:	0,
zoomSpeedOut		:	0,
zoomSpeedChange		:	300,
easingIn			:	'swing',
easingOut			:	'swing',
easingChange		:	'swing',
frameWidth			:	560,
frameHeight			:	340,
overlayShow			:	true,
overlayOpacity		:	0.3,
overlayColor		:	'#666',
enableEscapeButton	:	true,
showCloseButton		:	true,
hideOnOverlayClick	:	true,
hideOnContentClick	:	true,
centerOnScroll		:	true,
itemArray			:	[],
callbackOnStart		:	null,
callbackOnShow		:	null,
callbackOnClose		:	null
};
$(document).ready(function() {
ieQuirks = $.browser.msie && !$.boxModel;
if ($("#fancy_outer").length < 1) {
$.fn.fancybox.build();
}
});
})(jQuery);
;(function($) {
$.fn.extend({
autocomplete: function(urlOrData, options) {
var isUrl = typeof urlOrData == "string";
options = $.extend({}, $.Autocompleter.defaults, {
url: isUrl ? urlOrData : null,
data: isUrl ? null : urlOrData,
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
max: options && !options.scroll ? 10 : 150
}, options);
options.highlight = options.highlight || function(value) { return value; };
options.formatMatch = options.formatMatch || options.formatItem;
return this.each(function() {
new $.Autocompleter(this, options);
});
},
result: function(handler) {
return this.bind("result", handler);
},
search: function(handler) {
return this.trigger("search", [handler]);
},
flushCache: function() {
return this.trigger("flushCache");
},
setOptions: function(options){
return this.trigger("setOptions", [options]);
},
unautocomplete: function() {
return this.trigger("unautocomplete");
}
});
$.Autocompleter = function(input, options) {
var KEY = {
UP: 38,
DOWN: 40,
DEL: 46,
TAB: 9,
RETURN: 13,
ESC: 27,
COMMA: 188,
PAGEUP: 33,
PAGEDOWN: 34,
BACKSPACE: 8
};
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
var timeout;
var previousValue = "";
var cache = $.Autocompleter.Cache(options);
var hasFocus = 0;
var lastKeyPressCode;
var config = {
mouseDownOnSelect: false
};
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
var blockSubmit;
$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
if (blockSubmit) {
blockSubmit = false;
return false;
}
});
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
lastKeyPressCode = event.keyCode;
switch(event.keyCode) {
case KEY.UP:
event.preventDefault();
if ( select.visible() ) {
select.prev();
} else {
onChange(0, true);
}
break;
case KEY.DOWN:
event.preventDefault();
if ( select.visible() ) {
select.next();
} else {
onChange(0, true);
}
break;
case KEY.PAGEUP:
event.preventDefault();
if ( select.visible() ) {
select.pageUp();
} else {
onChange(0, true);
}
break;
case KEY.PAGEDOWN:
event.preventDefault();
if ( select.visible() ) {
select.pageDown();
} else {
onChange(0, true);
}
break;
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
case KEY.TAB:
case KEY.RETURN:
if( selectCurrent() ) {
event.preventDefault();
blockSubmit = true;
return false;
}
break;
case KEY.ESC:
select.hide();
break;
default:
clearTimeout(timeout);
timeout = setTimeout(onChange, options.delay);
break;
}
}).focus(function(){
hasFocus++;
}).blur(function() {
hasFocus = 0;
if (!config.mouseDownOnSelect) {
hideResults();
}
}).click(function() {
if ( hasFocus++ > 1 && !select.visible() ) {
onChange(0, true);
}
}).bind("search", function() {
var fn = (arguments.length > 1) ? arguments[1] : null;
function findValueCallback(q, data) {
var result;
if( data && data.length ) {
for (var i=0; i < data.length; i++) {
if( data[i].result.toLowerCase() == q.toLowerCase() ) {
result = data[i];
break;
}
}
}
if( typeof fn == "function" ) fn(result);
else $input.trigger("result", result && [result.data, result.value]);
}
$.each(trimWords($input.val()), function(i, value) {
request(value, findValueCallback, findValueCallback);
});
}).bind("flushCache", function() {
cache.flush();
}).bind("setOptions", function() {
$.extend(options, arguments[1]);
if ( "data" in arguments[1] )
cache.populate();
}).bind("unautocomplete", function() {
select.unbind();
$input.unbind();
$(input.form).unbind(".autocomplete");
});
function selectCurrent() {
var selected = select.selected();
if( !selected )
return false;
var v = selected.result;
previousValue = v;
if ( options.multiple ) {
var words = trimWords($input.val());
if ( words.length > 1 ) {
v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
}
v += options.multipleSeparator;
}
$input.val(v);
hideResultsNow();
$input.trigger("result", [selected.data, selected.value]);
return true;
}
function onChange(crap, skipPrevCheck) {
if( lastKeyPressCode == KEY.DEL ) {
select.hide();
return;
}
var currentValue = $input.val();
if ( !skipPrevCheck && currentValue == previousValue )
return;
previousValue = currentValue;
currentValue = lastWord(currentValue);
if ( currentValue.length >= options.minChars) {
$input.addClass(options.loadingClass);
if (!options.matchCase)
currentValue = currentValue.toLowerCase();
request(currentValue, receiveData, hideResultsNow);
} else {
stopLoading();
select.hide();
}
};
function trimWords(value) {
if ( !value ) {
return [""];
}
var words = value.split( options.multipleSeparator );
var result = [];
$.each(words, function(i, value) {
if ( $.trim(value) )
result[i] = $.trim(value);
});
return result;
}
function lastWord(value) {
if ( !options.multiple )
return value;
var words = trimWords(value);
return words[words.length - 1];
}
function autoFill(q, sValue){
if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
}
};
function hideResults() {
clearTimeout(timeout);
timeout = setTimeout(hideResultsNow, 200);
};
function hideResultsNow() {
var wasVisible = select.visible();
select.hide();
clearTimeout(timeout);
stopLoading();
if (options.mustMatch) {
$input.search(
function (result){
if( !result ) {
if (options.multiple) {
var words = trimWords($input.val()).slice(0, -1);
$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
}
else
$input.val( "" );
}
}
);
}
if (wasVisible)
$.Autocompleter.Selection(input, input.value.length, input.value.length);
};
function receiveData(q, data) {
if ( data && data.length && hasFocus ) {
stopLoading();
select.display(data, q);
autoFill(q, data[0].value);
select.show();
} else {
hideResultsNow();
}
};
function request(term, success, failure) {
if (!options.matchCase)
term = term.toLowerCase();
var data = cache.load(term);
if (data && data.length) {
success(term, data);
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
var extraParams = {
timestamp: +new Date()
};
$.each(options.extraParams, function(key, param) {
extraParams[key] = typeof param == "function" ? param() : param;
});
$.ajax({
mode: "abort",
port: "autocomplete" + input.name,
dataType: options.dataType,
url: options.url,
data: $.extend({
q: lastWord(term),
limit: options.max
}, extraParams),
success: function(data) {
var parsed = options.parse && options.parse(data) || parse(data);
cache.add(term, parsed);
success(term, parsed);
}
});
} else {
select.emptyList();
failure(term);
}
};
function parse(data) {
var parsed = [];
var rows = data.split("\n");
for (var i=0; i < rows.length; i++) {
var row = $.trim(rows[i]);
if (row) {
row = row.split("|");
parsed[parsed.length] = {
data: row,
value: row[0],
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
};
}
}
return parsed;
};
function stopLoading() {
$input.removeClass(options.loadingClass);
};
};
$.Autocompleter.defaults = {
inputClass: "ac_input",
resultsClass: "ac_results",
loadingClass: "ac_loading",
minChars: 1,
delay: 400,
matchCase: false,
matchSubset: true,
matchContains: false,
cacheLength: 10,
max: 100,
mustMatch: false,
extraParams: {},
selectFirst: true,
formatItem: function(row) { return row[0]; },
formatMatch: null,
autoFill: false,
width: 0,
multiple: false,
multipleSeparator: ", ",
highlight: function(value, term) {
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
},
scroll: true,
scrollHeight: 180
};
$.Autocompleter.Cache = function(options) {
var data = {};
var length = 0;
function matchSubset(s, sub) {
if (!options.matchCase)
s = s.toLowerCase();
var i = s.indexOf(sub);
if (i == -1) return false;
return i == 0 || options.matchContains;
};
function add(q, value) {
if (length > options.cacheLength){
flush();
}
if (!data[q]){
length++;
}
data[q] = value;
}
function populate(){
if( !options.data ) return false;
var stMatchSets = {},
nullData = 0;
if( !options.url ) options.cacheLength = 1;
stMatchSets[""] = [];
for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
var rawValue = options.data[i];
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
var value = options.formatMatch(rawValue, i+1, options.data.length);
if ( value === false )
continue;
var firstChar = value.charAt(0).toLowerCase();
if( !stMatchSets[firstChar] )
stMatchSets[firstChar] = [];
var row = {
value: value,
data: rawValue,
result: options.formatResult && options.formatResult(rawValue) || value
};
stMatchSets[firstChar].push(row);
if ( nullData++ < options.max ) {
stMatchSets[""].push(row);
}
};
$.each(stMatchSets, function(i, value) {
options.cacheLength++;
add(i, value);
});
}
setTimeout(populate, 25);
function flush(){
data = {};
length = 0;
}
return {
flush: flush,
add: add,
populate: populate,
load: function(q) {
if (!options.cacheLength || !length)
return null;
if( !options.url && options.matchContains ){
var csub = [];
for( var k in data ){
if( k.length > 0 ){
var c = data[k];
$.each(c, function(i, x) {
if (matchSubset(x.value, q)) {
csub.push(x);
}
});
}
}
return csub;
} else
if (data[q]){
return data[q];
} else
if (options.matchSubset) {
for (var i = q.length - 1; i >= options.minChars; i--) {
var c = data[q.substr(0, i)];
if (c) {
var csub = [];
$.each(c, function(i, x) {
if (matchSubset(x.value, q)) {
csub[csub.length] = x;
}
});
return csub;
}
}
}
return null;
}
};
};
$.Autocompleter.Select = function (options, input, select, config) {
var CLASSES = {
ACTIVE: "ac_over"
};
var listItems,
active = -1,
data,
term = "",
needsInit = true,
element,
list;
function init() {
if (!needsInit)
return;
element = $("<div/>")
.hide()
.addClass(options.resultsClass)
.css("position", "absolute")
.appendTo(document.body);
list = $("<ul/>").appendTo(element).mouseover( function(event) {
if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
$(target(event)).addClass(CLASSES.ACTIVE);
}
}).click(function(event) {
$(target(event)).addClass(CLASSES.ACTIVE);
select();
input.focus();
return false;
}).mousedown(function() {
config.mouseDownOnSelect = true;
}).mouseup(function() {
config.mouseDownOnSelect = false;
});
if( options.width > 0 )
element.css("width", options.width);
needsInit = false;
}
function target(event) {
var element = event.target;
while(element && element.tagName != "LI")
element = element.parentNode;
if(!element)
return [];
return element;
}
function moveSelect(step) {
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
movePosition(step);
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
if(options.scroll) {
var offset = 0;
listItems.slice(0, active).each(function() {
offset += this.offsetHeight;
});
if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
} else if(offset < list.scrollTop()) {
list.scrollTop(offset);
}
}
};
function movePosition(step) {
active += step;
if (active < 0) {
active = listItems.size() - 1;
} else if (active >= listItems.size()) {
active = 0;
}
}
function limitNumberOfItems(available) {
return options.max && options.max < available
? options.max
: available;
}
function fillList() {
list.empty();
var max = limitNumberOfItems(data.length);
for (var i=0; i < max; i++) {
if (!data[i])
continue;
var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
if ( formatted === false )
continue;
var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
$.data(li, "ac_data", data[i]);
}
listItems = list.find("li");
if ( options.selectFirst ) {
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
active = 0;
}
if ( $.fn.bgiframe )
list.bgiframe();
}
return {
display: function(d, q) {
init();
data = d;
term = q;
fillList();
},
next: function() {
moveSelect(1);
},
prev: function() {
moveSelect(-1);
},
pageUp: function() {
if (active != 0 && active - 8 < 0) {
moveSelect( -active );
} else {
moveSelect(-8);
}
},
pageDown: function() {
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
moveSelect( listItems.size() - 1 - active );
} else {
moveSelect(8);
}
},
hide: function() {
element && element.hide();
listItems && listItems.removeClass(CLASSES.ACTIVE);
active = -1;
},
visible : function() {
return element && element.is(":visible");
},
current: function() {
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
},
show: function() {
var offset = $(input).offset();
element.css({
width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
top: offset.top + input.offsetHeight,
left: offset.left
}).show();
if(options.scroll) {
list.scrollTop(0);
list.css({
maxHeight: options.scrollHeight,
overflow: 'auto'
});
if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
var listHeight = 0;
listItems.each(function() {
listHeight += this.offsetHeight;
});
var scrollbarsVisible = listHeight > options.scrollHeight;
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
if (!scrollbarsVisible) {
listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
}
}
}
},
selected: function() {
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
return selected && selected.length && $.data(selected[0], "ac_data");
},
emptyList: function (){
list && list.empty();
},
unbind: function() {
element && element.remove();
}
};
};
$.Autocompleter.Selection = function(field, start, end) {
if( field.createTextRange ){
var selRange = field.createTextRange();
selRange.collapse(true);
selRange.moveStart("character", start);
selRange.moveEnd("character", end);
selRange.select();
} else if( field.setSelectionRange ){
field.setSelectionRange(start, end);
} else {
if( field.selectionStart ){
field.selectionStart = start;
field.selectionEnd = end;
}
}
field.focus();
};
})(jQuery);
(function($){$.fn.sexyCombo=function(a){return this.each(function(){if("SELECT"!=this.tagName.toUpperCase()){return}new l(this,a)})};var h={skin:"sexy",suffix:"__sexyCombo",hiddenSuffix:"__sexyComboHidden",initialHiddenValue:"",emptyText:"",autoFill:false,triggerSelected:true,filterFn:null,dropUp:false,separator:",",showListCallback:null,hideListCallback:null,initCallback:null,initEventsCallback:null,changeCallback:null,textChangeCallback:null,checkWidth:true};$.sexyCombo=function(c,d){if(c.tagName.toUpperCase()!="SELECT")return;this.config=$.extend({},h,d||{});this.selectbox=$(c);this.options=this.selectbox.children().filter("option");this.wrapper=this.selectbox.wrap("<div>").hide().parent().addClass("combo").addClass(this.config.skin);this.input=$("<input type='text' />").appendTo(this.wrapper).attr("autocomplete","off").attr("value","").attr("name",this.selectbox.attr("name")+this.config.suffix);this.hidden=$("<input type='hidden' />").appendTo(this.wrapper).attr("autocomplete","off").attr("value",this.config.initialHiddenValue).attr("name",this.selectbox.attr("name")+this.config.hiddenSuffix);this.icon=$("<div />").appendTo(this.wrapper).addClass("icon");this.listWrapper=$("<div />").appendTo(this.wrapper).addClass("list-wrapper");this.updateDrop();this.list=$("<ul />").appendTo(this.listWrapper);var e=this;var f=[];this.options.each(function(){var a=$.trim($(this).text());if(e.config.checkWidth){f.push($("<li />").appendTo(e.list).html("<span>"+a+"</span>").addClass("visible").find("span").outerWidth())}else{$("<li />").appendTo(e.list).html("<span>"+a+"</span>").addClass("visible")}});this.listItems=this.list.children();if(f.length){f=f.sort(function(a,b){return a-b});var g=f[f.length-1]}this.singleItemHeight=this.listItems.outerHeight();this.listWrapper.addClass("invisible");if($.browser.opera){this.wrapper.css({position:"relative",left:"0",top:"0"})}this.filterFn=("function"==typeof(this.config.filterFn))?this.config.filterFn:this.filterFn;this.lastKey=null;this.multiple=this.selectbox.attr("multiple");var e=this;this.wrapper.data("sc:lastEvent","click");this.overflowCSS="overflowY";if((this.config.checkWidth)&&(this.listWrapper.innerWidth()<g)){this.overflowCSS="overflow"}this.notify("init");this.initEvents()};var l=$.sexyCombo;l.fn=l.prototype={};l.fn.extend=l.extend=$.extend;l.fn.extend({initEvents:function(){var a=this;this.icon.bind("click",function(e){if(!a.wrapper.data("sc:positionY")){a.wrapper.data("sc:positionY",e.pageY)}});this.input.bind("click",function(e){if(!a.wrapper.data("sc:positionY")){a.wrapper.data("sc:positionY",e.pageY)}});this.wrapper.bind("click",function(e){if(!a.wrapper.data("sc:positionY")){a.wrapper.data("sc:positionY",e.pageY)}});this.icon.bind("click",function(){if(a.input.attr("disabled")){a.input.attr("disabled",false)}a.wrapper.data("sc:lastEvent","click");a.filter();a.iconClick()});this.listItems.bind("mouseover",function(e){if("LI"==e.target.nodeName.toUpperCase()){a.highlight(e.target)}else{a.highlight($(e.target).parent())}});this.listItems.bind("click",function(e){a.listItemClick($(e.target))});this.input.bind("keyup",function(e){a.wrapper.data("sc:lastEvent","key");a.keyUp(e)});this.input.bind("keypress",function(e){if(l.KEY.RETURN==e.keyCode){e.preventDefault()}if(l.KEY.TAB==e.keyCode)e.preventDefault()});$(document).bind("click",function(e){if((a.icon.get(0)==e.target)||(a.input.get(0)==e.target))return;a.hideList()});this.triggerSelected();this.applyEmptyText();this.input.bind("click",function(e){a.wrapper.data("sc:lastEvent","click");a.icon.trigger("click")});this.wrapper.bind("click",function(){a.wrapper.data("sc:lastEvent","click")});this.input.bind("keydown",function(e){if(9==e.keyCode){e.preventDefault()}});this.wrapper.bind("keyup",function(e){var k=e.keyCode;for(key in l.KEY){if(l.KEY[key]==k){return}}a.wrapper.data("sc:lastEvent","key")});this.input.bind("click",function(){a.wrapper.data("sc:lastEvent","click")});this.icon.bind("click",function(e){if(!a.wrapper.data("sc:positionY")){a.wrapper.data("sc:positionY",e.pageY)}});this.input.bind("click",function(e){if(!a.wrapper.data("sc:positionY")){a.wrapper.data("sc:positionY",e.pageY)}});this.wrapper.bind("click",function(e){if(!a.wrapper.data("sc:positionY")){a.wrapper.data("sc:positionY",e.pageY)}});this.notify("initEvents")},getTextValue:function(){return this.__getValue("input")},getCurrentTextValue:function(){return this.__getCurrentValue("input")},getHiddenValue:function(){return this.__getValue("hidden")},getCurrentHiddenValue:function(){return this.__getCurrentValue("hidden")},__getValue:function(a){a=this[a];if(!this.multiple)return $.trim(a.val());var b=a.val().split(this.config.separator);var c=[];for(var i=0,len=b.length;i<len;++i){c.push($.trim(b[i]))}c=l.normalizeArray(c);return c},__getCurrentValue:function(a){a=this[a];if(!this.multiple)return $.trim(a.val());return $.trim(a.val().split(this.config.separator).pop())},iconClick:function(){if(this.listVisible()){this.hideList();this.input.blur()}else{this.showList();this.input.focus();if(this.input.val().length){this.selection(this.input.get(0),0,this.input.val().length)}}},listVisible:function(){return this.listWrapper.hasClass("visible")},showList:function(){if(!this.listItems.filter(".visible").length)return;this.listWrapper.removeClass("invisible").addClass("visible");this.wrapper.css("zIndex","99999");this.listWrapper.css("zIndex","99999");this.setListHeight();var a=this.listWrapper.height();var b=this.wrapper.height();var c=parseInt(this.wrapper.data("sc:positionY"))+b+a;var d=$(window).height()+$(document).scrollTop();if(c>d){this.setDropUp(true)}else{this.setDropUp(false)}if(""==$.trim(this.input.val())){this.highlightFirst();this.listWrapper.scrollTop(0)}else{this.highlightSelected()}this.notify("showList")},hideList:function(){if(this.listWrapper.hasClass("invisible"))return;this.listWrapper.removeClass("visible").addClass("invisible");this.wrapper.css("zIndex","0");this.listWrapper.css("zIndex","99999");this.notify("hideList")},getListItemsHeight:function(){var a=this.singleItemHeight;return a*this.liLen()},setOverflow:function(){var a=this.getListMaxHeight();if(this.getListItemsHeight()>a)this.listWrapper.css(this.overflowCSS,"scroll");else this.listWrapper.css(this.overflowCSS,"hidden")},highlight:function(a){if((l.KEY.DOWN==this.lastKey)||(l.KEY.UP==this.lastKey))return;this.listItems.removeClass("active");$(a).addClass("active")},setComboValue:function(a,b,c){var d=this.input.val();var v="";if(this.multiple){v=this.getTextValue();if(b)v.pop();v.push($.trim(a));v=l.normalizeArray(v);v=v.join(this.config.separator)+this.config.separator}else{v=$.trim(a)}this.input.val(v);this.setHiddenValue(a);this.filter();if(c)this.hideList();this.input.removeClass("empty");if(this.multiple)this.input.focus();if(this.input.val()!=d)this.notify("textChange")},setHiddenValue:function(a){var b=false;a=$.trim(a);var c=this.hidden.val();if(!this.multiple){for(var i=0,len=this.options.length;i<len;++i){if(a==this.options.eq(i).text()){this.hidden.val(this.options.eq(i).val());b=true;break}}}else{var d=this.getTextValue();var e=[];for(var i=0,len=d.length;i<len;++i){for(var j=0,len1=this.options.length;j<len1;++j){if(d[i]==this.options.eq(j).text()){e.push(this.options.eq(j).val())}}}if(e.length){b=true;this.hidden.val(e.join(this.config.separator))}}if(!b){this.hidden.val(this.config.initialHiddenValue)}if(c!=this.hidden.val())this.notify("change");this.selectbox.val(this.hidden.val());this.selectbox.trigger("change")},listItemClick:function(a){this.setComboValue(a.text(),true,true);this.inputFocus()},filter:function(){if("yes"==this.wrapper.data("sc:optionsChanged")){var c=this;this.listItems.remove();this.options=this.selectbox.children().filter("option");this.options.each(function(){var a=$.trim($(this).text());$("<li />").appendTo(c.list).text(a).addClass("visible")});this.listItems=this.list.children();this.listItems.bind("mouseover",function(e){c.highlight(e.target)});this.listItems.bind("click",function(e){c.listItemClick($(e.target))});c.wrapper.data("sc:optionsChanged","")}var d=this.input.val();var c=this;this.listItems.each(function(){var a=$(this);var b=a.text();if(c.filterFn.call(c,c.getCurrentTextValue(),b,c.getTextValue())){a.removeClass("invisible").addClass("visible")}else{a.removeClass("visible").addClass("invisible")}});this.setOverflow();this.setListHeight()},filterFn:function(a,b,c){if("click"==this.wrapper.data("sc:lastEvent")){return true}if(!this.multiple){return b.toLowerCase().indexOf(a.toLowerCase())==0}else{for(var i=0,len=c.length;i<len;++i){if(b==c[i]){return false}}return b.toLowerCase().search(a.toLowerCase())==0}},getListMaxHeight:function(){var a=parseInt(this.listWrapper.css("maxHeight"),10);if(isNaN(a)){a=this.singleItemHeight*10}return a},setListHeight:function(){var a=this.getListItemsHeight();var b=this.getListMaxHeight();var c=this.listWrapper.height();if(a<c){this.listWrapper.height(a);return a}else if(a>c){this.listWrapper.height(Math.min(b,a));return Math.min(b,a)}},getActive:function(){return this.listItems.filter(".active")},keyUp:function(e){this.lastKey=e.keyCode;var k=l.KEY;switch(e.keyCode){case k.RETURN:case k.TAB:this.setComboValue(this.getActive().text(),true,true);if(!this.multiple)this.input.blur();break;case k.DOWN:this.highlightNext();break;case k.UP:this.highlightPrev();break;case k.ESC:this.hideList();break;default:this.inputChanged();break}},liLen:function(){return this.listItems.filter(".visible").length},inputChanged:function(){this.filter();if(this.liLen()){this.showList();this.setOverflow();this.setListHeight()}else{this.hideList()}this.setHiddenValue(this.input.val());this.notify("textChange")},highlightFirst:function(){this.listItems.removeClass("active").filter(".visible:eq(0)").addClass("active");this.autoFill()},highlightSelected:function(){this.listItems.removeClass("active");var b=$.trim(this.input.val());try{this.listItems.each(function(){var a=$(this);if(a.text()==b){a.addClass("active");self.listWrapper.scrollTop(0);self.scrollDown()}})}catch(e){}},highlightNext:function(){var a=this.getActive().next();while(a.hasClass("invisible")&&a.length){a=a.next()}if(a.length){this.listItems.removeClass("active");a.addClass("active");this.scrollDown()}},scrollDown:function(){if("scroll"!=this.listWrapper.css(this.overflowCSS))return;var a=this.getActiveIndex()+1;var b=this.listItems.outerHeight()*a-this.listWrapper.height();if($.browser.msie)b+=a;if(this.listWrapper.scrollTop()<b)this.listWrapper.scrollTop(b)},highlightPrev:function(){var a=this.getActive().prev();while(a.length&&a.hasClass("invisible"))a=a.prev();if(a.length){this.getActive().removeClass("active");a.addClass("active");this.scrollUp()}},getActiveIndex:function(){return $.inArray(this.getActive().get(0),this.listItems.filter(".visible").get())},scrollUp:function(){if("scroll"!=this.listWrapper.css(this.overflowCSS))return;var a=this.getActiveIndex()*this.listItems.outerHeight();if(this.listWrapper.scrollTop()>a){this.listWrapper.scrollTop(a)}},applyEmptyText:function(){if(!this.config.emptyText.length)return;var a=this;this.input.bind("focus",function(){a.inputFocus()}).bind("blur",function(){a.inputBlur()});if(""==this.input.val()){this.input.addClass("empty").val(this.config.emptyText)}},inputFocus:function(){if(this.input.hasClass("empty")){this.input.removeClass("empty").val("")}},inputBlur:function(){if(""==this.input.val()){this.input.addClass("empty").val(this.config.emptyText)}},triggerSelected:function(){if(!this.config.triggerSelected)return;var a=this;try{this.options.each(function(){if($(this).attr("selected")){a.setComboValue($(this).text(),false,true);throw new Exception();}})}catch(e){return}a.setComboValue(this.options.eq(0).text(),false,false)},autoFill:function(){if(!this.config.autoFill||(l.KEY.BACKSPACE==this.lastKey)||this.multiple)return;var a=this.input.val();var b=this.getActive().text();this.input.val(b);this.selection(this.input.get(0),a.length,b.length)},selection:function(a,b,c){if(a.createTextRange){var d=a.createTextRange();d.collapse(true);d.moveStart("character",b);d.moveEnd("character",c);d.select()}else if(a.setSelectionRange){a.setSelectionRange(b,c)}else{if(a.selectionStart){a.selectionStart=b;a.selectionEnd=c}}},updateDrop:function(){if(this.config.dropUp)this.listWrapper.addClass("list-wrapper-up");else this.listWrapper.removeClass("list-wrapper-up")},setDropUp:function(a){this.config.dropUp=a;this.updateDrop()},notify:function(a){if(!$.isFunction(this.config[a+"Callback"]))return;this.config[a+"Callback"].call(this)}});l.extend({KEY:{UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8},log:function(a){var b=$("#log");b.html(b.html()+a+"<br />")},createSelectbox:function(a){var b=$("<select />").appendTo(a.container).attr({name:a.name,id:a.id,size:"1"});if(a.multiple)b.attr("multiple",true);var c=a.data;var d=false;for(var i=0,len=c.length;i<len;++i){d=c[i].selected||false;$("<option />").appendTo(b).attr("value",c[i].value).text(c[i].text).attr("selected",d)}return b.get(0)},create:function(b){var c={name:"",id:"",data:[],multiple:false,container:$(document),url:"",ajaxData:{}};b=$.extend({},c,b||{});if(b.url){return $.getJSON(b.url,b.ajaxData,function(a){delete b.url;delete b.ajaxData;b.data=a;return l.create(b)})}b.container=$(b.container);var d=l.createSelectbox(b);return new l(d,b)},deactivate:function(b){b=$(b);b.each(function(){if("SELECT"!=this.tagName.toUpperCase()){return}var a=$(this);if(!a.parent().is(".combo")){return}})},activate:function(b){b=$(b);b.each(function(){if("SELECT"!=this.tagName.toUpperCase()){return}var a=$(this);if(!a.parent().is(".combo")){return}a.parent().find("input[type='text']").attr("disabled",false)})},changeOptions:function(f){f=$(f);f.each(function(){if("SELECT"!=this.tagName.toUpperCase()){return}var a=$(this);var b=a.parent();var c=b.find("input[type='text']");var d=b.find("ul").parent();d.removeClass("visible").addClass("invisible");b.css("zIndex","0");d.css("zIndex","99999");c.val("");b.data("sc:optionsChanged","yes");var e=a;e.parent().find("input[type='text']").val(e.find("option:eq(0)").text());e.parent().data("sc:lastEvent","click");e.find("option:eq(0)").attr('selected','selected')})},normalizeArray:function(a){var b=[];for(var i=0,len=a.length;i<len;++i){if(""==a[i])continue;b.push(a[i])}return b}})})(jQuery);
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
(function(jQuery) {
jQuery.widget("ui.slider", jQuery.extend({}, jQuery.ui.mouse, {
_init: function() {
var self = this, o = this.options;
this._keySliding = false;
this._handleIndex = null;
this._detectOrientation();
this._mouseInit();
this.element
.addClass("ui-slider"
+ " ui-slider-" + this.orientation
+ " ui-widget"
+ " ui-widget-content"
+ " ui-corner-all");
var labelsHtml = jQuery(".ui-slider-labels",this.element).children();
if(labelsHtml && labelsHtml.length>1){
this.options.step=1;
this.options.min=1;
this.options.max=labelsHtml.length;
var stepDivisor =  labelsHtml.length-1; //(labelsHtml.length > 1) ? (labelsHtml.length-1) : 1;
var widthLabel = Math.floor(this.element.outerWidth()/stepDivisor);
var heightLabel = labelsHtml.eq(0).css('height');
labelsHtml.css('width',widthLabel+'px');
labelsHtml.eq(labelsHtml.length-1).css('width',widthLabel+1+'px');
labelsHtml.parent().css('width',widthLabel*(this.options.max)+1+'px');
labelsHtml.parent().css('margin-left',"-"+Math.floor(widthLabel/2)+'px');
}
this.range = jQuery([]);
if (o.range) {
this.range = jQuery('<div></div>');
if (o.range === true) {
if (!o.values) o.values = [this._valueMin(), this._valueMin()];
if (o.values.length && o.values.length != 2) {
o.values = [o.values[0], o.values[0]];
}
}
this.range.appendTo(this.element).addClass("ui-slider-range");
if (o.range == "min" || o.range == "max") {
this.range.addClass("ui-slider-range-" + o.range);
}
this.range.addClass("ui-widget-header");
}
if (jQuery(".ui-slider-handle", this.element).length == 0){
jQuery('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle");
}
if (o.values && o.values.length) {
while (jQuery(".ui-slider-handle", this.element).length < o.values.length){
jQuery('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle");
}
}
this.handles = jQuery(".ui-slider-handle", this.element).addClass("ui-state-default" + " ui-corner-all");
this.handle = this.handles.eq(0);
this.handles.add(this.range).filter("a")
.click(function(event) {
event.preventDefault();
})
.hover(function() {
if (!o.disabled) {
jQuery(this).addClass('ui-state-hover');
}
}, function() {
jQuery(this).removeClass('ui-state-hover');
})
.focus(function() {
if (!o.disabled) {
jQuery(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); jQuery(this).addClass('ui-state-focus');
} else {
jQuery(this).blur();
}
})
.blur(function() {
jQuery(this).removeClass('ui-state-focus');
});
this.handles.each(function(i) {
jQuery(this).data("index.ui-slider-handle", i);
});
this.handles.keydown(function(event) {
var ret = true;
var index = jQuery(this).data("index.ui-slider-handle");
if (self.options.disabled)
return;
switch (event.keyCode) {
case jQuery.ui.keyCode.HOME:
case jQuery.ui.keyCode.END:
case jQuery.ui.keyCode.UP:
case jQuery.ui.keyCode.RIGHT:
case jQuery.ui.keyCode.DOWN:
case jQuery.ui.keyCode.LEFT:
ret = false;
if (!self._keySliding) {
self._keySliding = true;
jQuery(this).addClass("ui-state-active");
self._start(event, index);
}
break;
}
var curVal, newVal, step = self._step();
if (self.options.values && self.options.values.length) {
curVal = newVal = self.values(index);
} else {
curVal = newVal = self.value();
}
switch (event.keyCode) {
case jQuery.ui.keyCode.HOME:
newVal = self._valueMin();
break;
case jQuery.ui.keyCode.END:
newVal = self._valueMax();
break;
case jQuery.ui.keyCode.UP:
case jQuery.ui.keyCode.RIGHT:
if(curVal == self._valueMax()) return;
newVal = curVal + step;
break;
case jQuery.ui.keyCode.DOWN:
case jQuery.ui.keyCode.LEFT:
if(curVal == self._valueMin()) return;
newVal = curVal - step;
break;
}
self._slide(event, index, newVal);
return ret;
}).keyup(function(event) {
var index = jQuery(this).data("index.ui-slider-handle");
if (self._keySliding) {
self._stop(event, index);
self._change(event, index);
self._keySliding = false;
jQuery(this).removeClass("ui-state-active");
}
});
this._refreshValue();
},
destroy: function() {
this.handles.remove();
this.range.remove();
this.element
.removeClass("ui-slider"
+ " ui-slider-horizontal"
+ " ui-slider-vertical"
+ " ui-slider-disabled"
+ " ui-widget"
+ " ui-widget-content"
+ " ui-corner-all")
.removeData("slider")
.unbind(".slider");
this._mouseDestroy();
return this;
},
_mouseCapture: function(event) {
var o = this.options;
if (o.disabled)
return false;
this.elementSize = {
width: this.element.outerWidth(),
height: this.element.outerHeight()
};
this.elementOffset = this.element.offset();
var position = { x: event.pageX, y: event.pageY };
var normValue = this._normValueFromMouse(position);
var distance = this._valueMax() - this._valueMin() + 1, closestHandle;
var self = this, index;
this.handles.each(function(i) {
var thisDistance = Math.abs(normValue - self.values(i));
if (distance > thisDistance) {
distance = thisDistance;
closestHandle = jQuery(this);
index = i;
}
});
if(o.range == true && this.values(1) == o.min) {
closestHandle = jQuery(this.handles[++index]);
}
this._start(event, index);
self._handleIndex = index;
closestHandle
.addClass("ui-state-active")
.focus();
var offset = closestHandle.offset();
var mouseOverHandle = !jQuery(event.target).parents().andSelf().is('.ui-slider-handle');
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
left: event.pageX - offset.left - (closestHandle.width() / 2),
top: event.pageY - offset.top
- (closestHandle.height() / 2)
- (parseInt(closestHandle.css('borderTopWidth'),10) || 0)
- (parseInt(closestHandle.css('borderBottomWidth'),10) || 0)
+ (parseInt(closestHandle.css('marginTop'),10) || 0)
};
normValue = this._normValueFromMouse(position);
this._slide(event, index, normValue);
return true;
},
_mouseStart: function(event) {
return true;
},
_mouseDrag: function(event) {
var position = { x: event.pageX, y: event.pageY };
var normValue = this._normValueFromMouse(position);
this._slide(event, this._handleIndex, normValue);
return false;
},
_mouseStop: function(event) {
this.handles.removeClass("ui-state-active");
this._stop(event, this._handleIndex);
this._change(event, this._handleIndex);
this._handleIndex = null;
this._clickOffset = null;
return false;
},
_detectOrientation: function() {
this.orientation = this.options.orientation == 'vertical' ? 'vertical' : 'horizontal';
},
_normValueFromMouse: function(position) {
var pixelTotal, pixelMouse;
if ('horizontal' == this.orientation) {
pixelTotal = this.elementSize.width;
pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
} else {
pixelTotal = this.elementSize.height;
pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
}
var percentMouse = (pixelMouse / pixelTotal);
if (percentMouse > 1) percentMouse = 1;
if (percentMouse < 0) percentMouse = 0;
if ('vertical' == this.orientation)
percentMouse = 1 - percentMouse;
var valueTotal = this._valueMax() - this._valueMin(),
valueMouse = percentMouse * valueTotal,
valueMouseModStep = valueMouse % this.options.step,
normValue = this._valueMin() + valueMouse - valueMouseModStep;
if (valueMouseModStep > (this.options.step / 2))
normValue += this.options.step;
return parseFloat(normValue.toFixed(5));
},
_start: function(event, index) {
var uiHash = {
handle: this.handles[index],
value: this.value()
};
if (this.options.values && this.options.values.length) {
uiHash.value = this.values(index);
uiHash.values = this.values();
}
this._trigger("start", event, uiHash);
},
_slide: function(event, index, newVal) {
var handle = this.handles[index];
if (this.options.values && this.options.values.length) {
var otherVal = this.values(index ? 0 : 1);
if ((this.options.values.length == 2 && this.options.range === true) &&
((index == 0 && newVal > otherVal) || (index == 1 && newVal < otherVal))){
newVal = otherVal;
}
if (newVal != this.values(index)) {
var newValues = this.values();
newValues[index] = newVal;
var allowed = this._trigger("slide", event, {
handle: this.handles[index],
value: newVal,
values: newValues
});
var otherVal = this.values(index ? 0 : 1);
if (allowed !== false) {
this.values(index, newVal, ( event.type == 'mousedown' && this.options.animate ), true);
}
}
} else {
if (newVal != this.value()) {
var allowed = this._trigger("slide", event, {
handle: this.handles[index],
value: newVal
});
if (allowed !== false) {
this._setData('value', newVal, ( event.type == 'mousedown' && this.options.animate ));
}
}
}
},
_stop: function(event, index) {
var uiHash = {
handle: this.handles[index],
value: this.value()
};
if (this.options.values && this.options.values.length) {
uiHash.value = this.values(index);
uiHash.values = this.values();
}
this._trigger("stop", event, uiHash);
},
_change: function(event, index) {
var uiHash = {
handle: this.handles[index],
value: this.value()
};
if (this.options.values && this.options.values.length) {
uiHash.value = this.values(index);
uiHash.values = this.values();
}
this._trigger("change", event, uiHash);
},
value: function(newValue) {
if (arguments.length) {
this._setData("value", newValue);
this._change(null, 0);
}
return this._value();
},
values: function(index, newValue, animated, noPropagation) {
if (arguments.length > 1) {
this.options.values[index] = newValue;
this._refreshValue(animated);
if(!noPropagation) this._change(null, index);
}
if (arguments.length) {
if (this.options.values && this.options.values.length) {
return this._values(index);
} else {
return this.value();
}
} else {
return this._values();
}
},
_setData: function(key, value, animated) {
jQuery.widget.prototype._setData.apply(this, arguments);
switch (key) {
case 'disabled':
if (value) {
this.handles.filter(".ui-state-focus").blur();
this.handles.removeClass("ui-state-hover");
this.handles.attr("disabled", "disabled");
} else {
this.handles.removeAttr("disabled");
}
case 'orientation':
this._detectOrientation();
this.element
.removeClass("ui-slider-horizontal ui-slider-vertical")
.addClass("ui-slider-" + this.orientation);
this._refreshValue(animated);
break;
case 'value':
this._refreshValue(animated);
break;
}
},
_step: function() {
var step = this.options.step;
return step;
},
_value: function() {
var val = this.options.value;
if (val < this._valueMin()) val = this._valueMin();
if (val > this._valueMax()) val = this._valueMax();
return val;
},
_values: function(index) {
if (arguments.length) {
var val = this.options.values[index];
if (val < this._valueMin()) val = this._valueMin();
if (val > this._valueMax()) val = this._valueMax();
return val;
} else {
return this.options.values.slice();
}
},
_valueMin: function() {
var valueMin = this.options.min;
return valueMin;
},
_valueMax: function() {
var valueMax = this.options.max;
return valueMax;
},
_refreshValue: function(animate) {
var oRange = this.options.range, o = this.options, self = this;
if (this.options.values && this.options.values.length) {
var vp0, vp1;
this.handles.each(function(i, j) {
var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100;
var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
jQuery(this).stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
if (self.options.range === true) {
if (self.orientation == 'horizontal') {
(i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ left: valPercent + '%' }, o.animate);
(i == 1) && self.range[animate ? 'animate' : 'css']({ width: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
} else {
(i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ bottom: (valPercent) + '%' }, o.animate);
(i == 1) && self.range[animate ? 'animate' : 'css']({ height: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
}
}
lastValPercent = valPercent;
});
} else {
var value = this.value(),
valueMin = this._valueMin(),
valueMax = this._valueMax(),
valPercent = valueMax != valueMin  ? (value - valueMin) / (valueMax - valueMin) * 100  : 0;
var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
var labelsHtml = jQuery(".ui-slider-labels",self.element).children();
var markersel = (oRange != "max") ? o.markerselected :  o.marker;
var marker = (oRange != "max") ? o.marker : o.markerselected;
for(var i=1;i<=labelsHtml.length;i++){
if (!oRange || oRange=='false'){
if (i==value){
if (markersel)	labelsHtml.eq(i-1).css('background-image',"url('"+markersel+"')");
}
else{
if (marker)	labelsHtml.eq(i-1).css('background-image',"url('"+marker+"')");
}
}else{
if (i<=value){
if (markersel)	labelsHtml.eq(i-1).css('background-image',"url('"+markersel+"')");
}
else{
if (marker)	labelsHtml.eq(i-1).css('background-image',"url('"+marker+"')");
}
}
}
(oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate);
(oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
(oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate);
(oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
}
if (o.input!=false){
jQuery(o.input).val(value);
}
}
}));
jQuery.extend(jQuery.ui.slider, {
version: "@VERSION",
eventPrefix: "slide",
defaults: jQuery.extend({}, jQuery.ui.mouse.defaults, {
animate: false,
distance: 0,
max: 100,
min: 0,
orientation: 'horizontal',
range: false,
step: 1,
value: 0,
values: null,
markerselected: 'images/slider-step.gif',
marker: 'images/slider-step-next.gif',
input: false
})
});
})(jQuery);
(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return}var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p<r&&q.call(s,p,s)!==false;s=t[++p]){}}return t}function c(o){return document.getElementById(o)}function i(q,p,o){if(typeof p!="object"){return q}if(q&&p){m(p,function(r,s){if(!o||typeof s!="function"){q[r]=s}})}return q}function n(s){var q=s.indexOf(".");if(q!=-1){var p=s.slice(0,q)||"*";var o=s.slice(q+1,s.length);var r=[];m(document.getElementsByTagName(p),function(){if(this.className&&this.className.indexOf(o)!=-1){r.push(this)}});return r}}function f(o){o=o||window.event;if(o.preventDefault){o.stopPropagation();o.preventDefault()}else{o.returnValue=false;o.cancelBubble=true}return false}function j(q,o,p){q[o]=q[o]||[];q[o].push(p)}function e(){return"_"+(""+Math.random()).slice(2,10)}var h=function(t,r,s){var q=this,p={},u={};q.index=r;if(typeof t=="string"){t={url:t}}i(this,t,true);m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var v="on"+this;if(v.indexOf("*")!=-1){v=v.slice(0,v.length-1);var w="onBefore"+v.slice(2);q[w]=function(x){j(u,w,x);return q}}q[v]=function(x){j(u,v,x);return q};if(r==-1){if(q[w]){s[w]=q[w]}if(q[v]){s[v]=q[v]}}});i(this,{onCuepoint:function(x,w){if(arguments.length==1){p.embedded=[null,x];return q}if(typeof x=="number"){x=[x]}var v=e();p[v]=[x,w];if(s.isLoaded()){s._api().fp_addCuepoints(x,r,v)}return q},update:function(w){i(q,w);if(s.isLoaded()){s._api().fp_updateClip(w,r)}var v=s.getConfig();var x=(r==-1)?v.clip:v.playlist[r];i(x,w,true)},_fireEvent:function(v,y,w,A){if(v=="onLoad"){m(p,function(B,C){if(C[0]){s._api().fp_addCuepoints(C[0],r,B)}});return false}A=A||q;if(v=="onCuepoint"){var z=p[y];if(z){return z[1].call(s,A,w)}}if(y&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(v)!=-1){i(A,y);if(y.metaData){if(!A.duration){A.duration=y.metaData.duration}else{A.fullDuration=y.metaData.duration}}}var x=true;m(u[v],function(){x=this.call(s,A,y,w)});return x}});if(t.onCuepoint){var o=t.onCuepoint;q.onCuepoint.apply(q,typeof o=="function"?[o]:o);delete t.onCuepoint}m(t,function(v,w){if(typeof w=="function"){j(u,v,w);delete t[v]}});if(r==-1){s.onCuepoint=this.onCuepoint}};var l=function(p,r,q,t){var o=this,s={},u=false;if(t){i(s,t)}m(r,function(v,w){if(typeof w=="function"){s[v]=w;delete r[v]}});i(this,{animate:function(y,z,x){if(!y){return o}if(typeof z=="function"){x=z;z=500}if(typeof y=="string"){var w=y;y={};y[w]=z;z=500}if(x){var v=e();s[v]=x}if(z===undefined){z=500}r=q._api().fp_animate(p,y,z,v);return o},css:function(w,x){if(x!==undefined){var v={};v[w]=x;w=v}r=q._api().fp_css(p,w);i(o,r);return o},show:function(){this.display="block";q._api().fp_showPlugin(p);return o},hide:function(){this.display="none";q._api().fp_hidePlugin(p);return o},toggle:function(){this.display=q._api().fp_togglePlugin(p);return o},fadeTo:function(y,x,w){if(typeof x=="function"){w=x;x=500}if(w){var v=e();s[v]=w}this.display=q._api().fp_fadeTo(p,y,x,v);this.opacity=y;return o},fadeIn:function(w,v){return o.fadeTo(1,w,v)},fadeOut:function(w,v){return o.fadeTo(0,w,v)},getName:function(){return p},getPlayer:function(){return q},_fireEvent:function(w,v,x){if(w=="onUpdate"){var z=q._api().fp_getPlugin(p);if(!z){return}i(o,z);delete o.methods;if(!u){m(z.methods,function(){var B=""+this;o[B]=function(){var C=[].slice.call(arguments);var D=q._api().fp_invoke(p,B,C);return D==="undefined"||D===undefined?o:D}});u=true}}var A=s[w];if(A){var y=A.apply(o,v);if(w.slice(0,1)=="_"){delete s[w]}return y}return o}})};function b(q,G,t){var w=this,v=null,D=false,u,s,F=[],y={},x={},E,r,p,C,o,A;i(w,{id:function(){return E},isLoaded:function(){return(v!==null&&v.fp_play!==undefined&&!D)},getParent:function(){return q},hide:function(H){if(H){q.style.height="0px"}if(w.isLoaded()){v.style.height="0px"}return w},show:function(){q.style.height=A+"px";if(w.isLoaded()){v.style.height=o+"px"}return w},isHidden:function(){return w.isLoaded()&&parseInt(v.style.height,10)===0},load:function(J){if(!w.isLoaded()&&w._fireEvent("onBeforeLoad")!==false){var H=function(){u=q.innerHTML;if(u&&!flashembed.isSupported(G.version)){q.innerHTML=""}if(J){J.cached=true;j(x,"onLoad",J)}flashembed(q,G,{config:t})};var I=0;m(a,function(){this.unload(function(K){if(++I==a.length){H()}})})}return w},unload:function(J){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent)){if(J){J(false)}return w}if(u.replace(/\s/g,"")!==""){if(w._fireEvent("onBeforeUnload")===false){if(J){J(false)}return w}D=true;try{if(v){v.fp_close();w._fireEvent("onUnload")}}catch(H){}var I=function(){v=null;q.innerHTML=u;D=false;if(J){J(true)}};setTimeout(I,50)}else{if(J){J(false)}}return w},getClip:function(H){if(H===undefined){H=C}return F[H]},getCommonClip:function(){return s},getPlaylist:function(){return F},getPlugin:function(H){var J=y[H];if(!J&&w.isLoaded()){var I=w._api().fp_getPlugin(H);if(I){J=new l(H,I,w);y[H]=J}}return J},getScreen:function(){return w.getPlugin("screen")},getControls:function(){return w.getPlugin("controls")._fireEvent("onUpdate")},getLogo:function(){try{return w.getPlugin("logo")._fireEvent("onUpdate")}catch(H){}},getPlay:function(){return w.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(H){return H?k(t):t},getFlashParams:function(){return G},loadPlugin:function(K,J,M,L){if(typeof M=="function"){L=M;M={}}var I=L?e():"_";w._api().fp_loadPlugin(K,J,M,I);var H={};H[I]=L;var N=new l(K,null,w,H);y[K]=N;return N},getState:function(){return w.isLoaded()?v.fp_getState():-1},play:function(I,H){var J=function(){if(I!==undefined){w._api().fp_play(I,H)}else{w._api().fp_play()}};if(w.isLoaded()){J()}else{if(D){setTimeout(function(){w.play(I,H)},50)}else{w.load(function(){J()})}}return w},getVersion:function(){var I="flowplayer.js 3.2.4";if(w.isLoaded()){var H=v.fp_getVersion();H.push(I);return H}return I},_api:function(){if(!w.isLoaded()){throw"Flowplayer "+w.id()+" not loaded when calling an API method"}return v},setClip:function(H){w.setPlaylist([H]);return w},getIndex:function(){return p},_swfHeight:function(){return v.clientHeight}});m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var H="on"+this;if(H.indexOf("*")!=-1){H=H.slice(0,H.length-1);var I="onBefore"+H.slice(2);w[I]=function(J){j(x,I,J);return w}}w[H]=function(J){j(x,H,J);return w}});m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","),function(){var H=this;w[H]=function(J,I){if(!w.isLoaded()){return w}var K=null;if(J!==undefined&&I!==undefined){K=v["fp_"+H](J,I)}else{K=(J===undefined)?v["fp_"+H]():v["fp_"+H](J)}return K==="undefined"||K===undefined?w:K}});w._fireEvent=function(Q){if(typeof Q=="string"){Q=[Q]}var R=Q[0],O=Q[1],M=Q[2],L=Q[3],K=0;if(t.debug){g(Q)}if(!w.isLoaded()&&R=="onLoad"&&O=="player"){v=v||c(r);o=w._swfHeight();m(F,function(){this._fireEvent("onLoad")});m(y,function(S,T){T._fireEvent("onUpdate")});s._fireEvent("onLoad")}if(R=="onLoad"&&O!="player"){return}if(R=="onError"){if(typeof O=="string"||(typeof O=="number"&&typeof M=="number")){O=M;M=L}}if(R=="onContextMenu"){m(t.contextMenu[O],function(S,T){T.call(w)});return}if(R=="onPluginEvent"||R=="onBeforePluginEvent"){var H=O.name||O;var I=y[H];if(I){I._fireEvent("onUpdate",O);return I._fireEvent(M,Q.slice(3))}return}if(R=="onPlaylistReplace"){F=[];var N=0;m(O,function(){F.push(new h(this,N++,w))})}if(R=="onClipAdd"){if(O.isInStream){return}O=new h(O,M,w);F.splice(M,0,O);for(K=M+1;K<F.length;K++){F[K].index++}}var P=true;if(typeof O=="number"&&O<F.length){C=O;var J=F[O];if(J){P=J._fireEvent(R,M,L)}if(!J||P!==false){P=s._fireEvent(R,M,L,J)}}m(x[R],function(){P=this.call(w,O,M);if(this.cached){x[R].splice(K,1)}if(P===false){return false}K++});return P};function B(){if($f(q)){$f(q).getParent().innerHTML="";p=$f(q).getIndex();a[p]=w}else{a.push(w);p=a.length-1}A=parseInt(q.style.height,10)||q.clientHeight;E=q.id||"fp"+e();r=G.id||E+"_api";G.id=r;t.playerId=E;if(typeof t=="string"){t={clip:{url:t}}}if(typeof t.clip=="string"){t.clip={url:t.clip}}t.clip=t.clip||{};if(q.getAttribute("href",2)&&!t.clip.url){t.clip.url=q.getAttribute("href",2)}s=new h(t.clip,-1,w);t.playlist=t.playlist||[t.clip];var I=0;m(t.playlist,function(){var K=this;if(typeof K=="object"&&K.length){K={url:""+K}}m(t.clip,function(L,M){if(M!==undefined&&K[L]===undefined&&typeof M!="function"){K[L]=M}});t.playlist[I]=K;K=new h(K,I,w);F.push(K);I++});m(t,function(K,L){if(typeof L=="function"){if(s[K]){s[K](L)}else{j(x,K,L)}delete t[K]}});m(t.plugins,function(K,L){if(L){y[K]=new l(K,L,w)}});if(!t.plugins||t.plugins.controls===undefined){y.controls=new l("controls",null,w)}y.canvas=new l("canvas",null,w);u=q.innerHTML;function J(L){var K=w.hasiPadSupport&&w.hasiPadSupport();if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(F[0].url)&&!K){return true}if(!w.isLoaded()&&w._fireEvent("onBeforeClick")!==false){w.load()}return f(L)}function H(){if(u.replace(/\s/g,"")!==""){if(q.addEventListener){q.addEventListener("click",J,false)}else{if(q.attachEvent){q.attachEvent("onclick",J)}}}else{if(q.addEventListener){q.addEventListener("click",f,false)}w.load()}}setTimeout(H,0)}if(typeof q=="string"){var z=c(q);if(!z){throw"Flowplayer cannot access element: "+q}q=z;B()}else{B()}}var a=[];function d(o){this.length=o.length;this.each=function(p){m(o,p)};this.size=function(){return o.length}}window.flowplayer=window.$f=function(){var p=null;var o=arguments[0];if(!arguments.length){m(a,function(){if(this.isLoaded()){p=this;return false}});return p||a[0]}if(arguments.length==1){if(typeof o=="number"){return a[o]}else{if(o=="*"){return new d(a)}m(a,function(){if(this.id()==o.id||this.id()==o||this.getParent()==o){p=this;return false}});return p}}if(arguments.length>1){var t=arguments[1],q=(arguments.length==3)?arguments[2]:{};if(typeof t=="string"){t={src:t}}t=i({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:true},t);if(typeof o=="string"){if(o.indexOf(".")!=-1){var s=[];m(n(o),function(){s.push(new b(this,k(t),k(q)))});return new d(s)}else{var r=c(o);return new b(r!==null?r:o,t,q)}}else{if(o){return new b(o,t,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var h=document.all,j="http://www.adobe.com/go/getflashplayer",c=typeof jQuery=="function",e=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,b={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function i(m,l){if(l){for(var f in l){if(l.hasOwnProperty(f)){m[f]=l[f]}}}return m}function a(f,n){var m=[];for(var l in f){if(f.hasOwnProperty(l)){m[l]=n(f[l])}}return m}window.flashembed=function(f,m,l){if(typeof f=="string"){f=document.getElementById(f.replace("#",""))}if(!f){return}if(typeof m=="string"){m={src:m}}return new d(f,i(i({},b),m),l)};var g=i(window.flashembed,{conf:b,getVersion:function(){var m,f;try{f=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(o){try{m=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");f=m&&m.GetVariable("$version")}catch(n){try{m=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");f=m&&m.GetVariable("$version")}catch(l){}}}f=e.exec(f);return f?[f[1],f[3]]:[0,0]},asString:function(l){if(l===null||l===undefined){return null}var f=typeof l;if(f=="object"&&l.push){f="array"}switch(f){case"string":l=l.replace(new RegExp('(["\\\\])',"g"),"\\$1");l=l.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return'"'+l+'"';case"array":return"["+a(l,function(o){return g.asString(o)}).join(",")+"]";case"function":return'"function()"';case"object":var m=[];for(var n in l){if(l.hasOwnProperty(n)){m.push('"'+n+'":'+g.asString(l[n]))}}return"{"+m.join(",")+"}"}return String(l).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(o,l){o=i({},o);var n='<object width="'+o.width+'" height="'+o.height+'" id="'+o.id+'" name="'+o.id+'"';if(o.cachebusting){o.src+=((o.src.indexOf("?")!=-1?"&":"?")+Math.random())}if(o.w3c||!h){n+=' data="'+o.src+'" type="application/x-shockwave-flash"'}else{n+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}n+=">";if(o.w3c||h){n+='<param name="movie" value="'+o.src+'" />'}o.width=o.height=o.id=o.w3c=o.src=null;o.onFail=o.version=o.expressInstall=null;for(var m in o){if(o[m]){n+='<param name="'+m+'" value="'+o[m]+'" />'}}var p="";if(l){for(var f in l){if(l[f]){var q=l[f];p+=f+"="+(/function|object/.test(typeof q)?g.asString(q):q)+"&"}}p=p.slice(0,-1);n+='<param name="flashvars" value=\''+p+"' />"}n+="</object>";return n},isSupported:function(f){return k[0]>f[0]||k[0]==f[0]&&k[1]>=f[1]}});var k=g.getVersion();function d(f,n,m){if(g.isSupported(n.version)){f.innerHTML=g.getHTML(n,m)}else{if(n.expressInstall&&g.isSupported([6,65])){f.innerHTML=g.getHTML(i(n,{src:n.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title})}else{if(!f.innerHTML.replace(/\s/g,"")){f.innerHTML="<h2>Flash version "+n.version+" or greater is required</h2><h3>"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"</h3>"+(f.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+j+"'>here</a></p>");if(f.tagName=="A"){f.onclick=function(){location.href=j}}}if(n.onFail){var l=n.onFail.call(this);if(typeof l=="string"){f.innerHTML=l}}}}if(h){window[n.id]=document.getElementById(n.id)}i(this,{getRoot:function(){return f},getOptions:function(){return n},getConf:function(){return m},getApi:function(){return f.firstChild}})}if(c){jQuery.tools=jQuery.tools||{version:"3.2.4"};jQuery.tools.flashembed={conf:b};jQuery.fn.flashembed=function(l,f){return this.each(function(){$(this).data("flashembed",flashembed(this,l,f))})}}})();
;(function($) {
var helper = {},
current,
title,
tID,
IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
track = false;
$.tooltip = {
blocked: false,
defaults: {
delay: 200,
fade: false,
showURL: true,
extraClass: "",
top: 15,
left: 15,
id: "tooltip"
},
block: function() {
$.tooltip.blocked = !$.tooltip.blocked;
}
};
$.fn.extend({
tooltip: function(settings) {
settings = $.extend({}, $.tooltip.defaults, settings);
createHelper(settings);
return this.each(function() {
$.data(this, "tooltip", settings);
this.tOpacity = helper.parent.css("opacity");
this.tooltipText = this.title;
$(this).removeAttr("title");
this.alt = "";
})
.mouseover(save)
.mouseout(hide)
.click(hide);
},
fixPNG: IE ? function() {
return this.each(function () {
var image = $(this).css('backgroundImage');
if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
image = RegExp.$1;
$(this).css({
'backgroundImage': 'none',
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
}).each(function () {
var position = $(this).css('position');
if (position != 'absolute' && position != 'relative')
$(this).css('position', 'relative');
});
}
});
} : function() { return this; },
unfixPNG: IE ? function() {
return this.each(function () {
$(this).css({'filter': '', backgroundImage: ''});
});
} : function() { return this; },
hideWhenEmpty: function() {
return this.each(function() {
$(this)[ $(this).html() ? "show" : "hide" ]();
});
},
url: function() {
return this.attr('href') || this.attr('src');
}
});
function createHelper(settings) {
if( helper.parent )
return;
helper.parent = $('<div id="' + settings.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>')
.appendTo(document.body)
.hide();
if ( $.fn.bgiframe )
helper.parent.bgiframe();
helper.title = $('h3', helper.parent);
helper.body = $('div.body', helper.parent);
helper.url = $('div.url', helper.parent);
}
function settings(element) {
return $.data(element, "tooltip");
}
function handle(event) {
if( settings(this).delay )
tID = setTimeout(show, settings(this).delay);
else
show();
track = !!settings(this).track;
$(document.body).bind('mousemove', update);
update(event);
}
function save() {
if ( $.tooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler) )
return;
current = this;
title = this.tooltipText;
if ( settings(this).bodyHandler ) {
helper.title.hide();
var bodyContent = settings(this).bodyHandler.call(this);
if (bodyContent.nodeType || bodyContent.jquery) {
helper.body.empty().append(bodyContent)
} else {
helper.body.html( bodyContent );
}
helper.body.show();
} else if ( settings(this).showBody ) {
var parts = title.split(settings(this).showBody);
helper.title.html(parts.shift()).show();
helper.body.empty();
for(var i = 0, part; (part = parts[i]); i++) {
if(i > 0)
helper.body.append("<br/>");
helper.body.append(part);
}
helper.body.hideWhenEmpty();
} else {
helper.title.html(title).show();
helper.body.hide();
}
if( settings(this).showURL && $(this).url() )
helper.url.html( $(this).url().replace('http://', '') ).show();
else
helper.url.hide();
helper.parent.addClass(settings(this).extraClass);
if (settings(this).fixPNG )
helper.parent.fixPNG();
handle.apply(this, arguments);
}
function show() {
tID = null;
if ((!IE || !$.fn.bgiframe) && settings(current).fade) {
if (helper.parent.is(":animated"))
helper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity);
else
helper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade);
} else {
helper.parent.show();
}
update();
}
function update(event)	{
if($.tooltip.blocked)
return;
if (event && event.target.tagName == "OPTION") {
return;
}
if ( !track && helper.parent.is(":visible")) {
$(document.body).unbind('mousemove', update)
}
if( current == null ) {
$(document.body).unbind('mousemove', update);
return;
}
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
var left = helper.parent[0].offsetLeft;
var top = helper.parent[0].offsetTop;
if (event) {
left = event.pageX + settings(current).left;
top = event.pageY + settings(current).top;
var right='auto';
if (settings(current).positionLeft) {
right = $(window).width() - left;
left = 'auto';
}
helper.parent.css({
left: left,
right: right,
top: top
});
}
var v = viewport(),
h = helper.parent[0];
if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
left -= h.offsetWidth + 20 + settings(current).left-130;
helper.parent.css({left: left + 'px'}).addClass("viewport-right");
}
if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
top -= h.offsetHeight + 20 + settings(current).top;
helper.parent.css({top: top + 'px'}).addClass("viewport-bottom");
}
}
function viewport() {
return {
x: $(window).scrollLeft(),
y: $(window).scrollTop(),
cx: $(window).width(),
cy: $(window).height()
};
}
function hide(event) {
if($.tooltip.blocked)
return;
if(tID)
clearTimeout(tID);
current = null;
var tsettings = settings(this);
function complete() {
helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", "");
}
if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
if (helper.parent.is(':animated'))
helper.parent.stop().fadeTo(tsettings.fade, 0, complete);
else
helper.parent.stop().fadeOut(tsettings.fade, complete);
} else
complete();
if( settings(this).fixPNG )
helper.parent.unfixPNG();
}
})(jQuery);
(function($) {
$.event.special.mousewheel = {
setup: function() {
var handler = $.event.special.mousewheel.handler;
if ( $.browser.mozilla )
$(this).bind('mousemove.mousewheel', function(event) {
$.data(this, 'mwcursorposdata', {
pageX: event.pageX,
pageY: event.pageY,
clientX: event.clientX,
clientY: event.clientY
});
});
if ( this.addEventListener )
this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
else
this.onmousewheel = handler;
},
teardown: function() {
var handler = $.event.special.mousewheel.handler;
$(this).unbind('mousemove.mousewheel');
if ( this.removeEventListener )
this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
else
this.onmousewheel = function(){};
$.removeData(this, 'mwcursorposdata');
},
handler: function(event) {
var args = Array.prototype.slice.call( arguments, 1 );
event = $.event.fix(event || window.event);
$.extend( event, $.data(this, 'mwcursorposdata') || {} );
var delta = 0, returnValue = true;
if ( event.wheelDelta ) delta = event.wheelDelta/120;
if ( event.detail     ) delta = -event.detail/3;
event.data  = event.data || {};
event.type  = "mousewheel";
args.unshift(delta);
args.unshift(event);
return $.event.handle.apply(this, args);
}
};
$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
},
unmousewheel: function(fn) {
return this.unbind("mousewheel", fn);
}
});
})(jQuery);
(function($) {
$.jScrollPane = {
active : []
};
$.fn.jScrollPane = function(settings)
{
settings = $.extend({}, $.fn.jScrollPane.defaults, settings);
var rf = function() { return false; };
return this.each(
function()
{
var $this = $(this);
$this.css('overflow', 'hidden');
var paneEle = this;
if ($(this).parent().is('.jScrollPaneContainer')) {
var currentScrollPosition = settings.maintainPosition ? $this.position().top : (0-settings.positionStartY);
var $c = $(this).parent();
var paneWidth = $c.innerWidth();
var paneHeight = $c.outerHeight();
var trackHeight = paneHeight;
$('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown', $c).remove();
$this.css({'top':0});
} else {
var currentScrollPosition = 0-settings.positionStartY;
this.originalPadding = $this.css('paddingTop') + ' ' + $this.css('paddingRight') + ' ' + $this.css('paddingBottom') + ' ' + $this.css('paddingLeft');
this.originalSidePaddingTotal = (parseInt($this.css('paddingLeft')) || 0) + (parseInt($this.css('paddingRight')) || 0);
var paneWidth = $this.innerWidth();
var paneHeight = $this.innerHeight();
var trackHeight = paneHeight;
$this.wrap(
$('<div></div>').attr(
{'className':'jScrollPaneContainer'}
).css(
{
'height':paneHeight+'px',
'width':paneWidth+'px'
}
)
);
$(document).bind(
'emchange',
function(e, cur, prev)
{
$this.jScrollPane(settings);
}
);
}
if (settings.reinitialiseOnImageLoad) {
var $imagesToLoad = $.data(paneEle, 'jScrollPaneImagesToLoad') || $('img', $this);
var loadedImages = [];
if ($imagesToLoad.length) {
$imagesToLoad.each(function(i, val)	{
$(this).bind('load', function() {
if($.inArray(i, loadedImages) == -1){ //don't double count images
loadedImages.push(val); //keep a record of images we've seen
$imagesToLoad = $.grep($imagesToLoad, function(n, i) {
return n != val;
});
$.data(paneEle, 'jScrollPaneImagesToLoad', $imagesToLoad);
settings.reinitialiseOnImageLoad = false;
$this.jScrollPane(settings); // re-initialise
}
}).each(function(i, val) {
if(this.complete || this.complete===undefined) {
this.src = this.src;
}
});
});
};
}
var p = this.originalSidePaddingTotal;
var cssToApply = {
'height':'auto',
'width':paneWidth - settings.scrollbarWidth - settings.scrollbarMargin - p + 'px'
}
if(settings.scrollbarOnLeft) {
cssToApply.paddingLeft = settings.scrollbarMargin + settings.scrollbarWidth + 'px';
} else {
cssToApply.paddingRight = settings.scrollbarMargin + 'px';
}
$this.css(cssToApply);
var contentHeight = $this.outerHeight();
var percentInView = paneHeight / contentHeight;
if (percentInView < .99) {
var $container = $this.parent();
$container.append(
$('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append(
$('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append(
$('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),
$('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'})
)
)
);
var $track = $('>.jScrollPaneTrack', $container);
var $drag = $('>.jScrollPaneTrack .jScrollPaneDrag', $container);
if (settings.showArrows) {
var currentArrowButton;
var currentArrowDirection;
var currentArrowInterval;
var currentArrowInc;
var whileArrowButtonDown = function()
{
if (currentArrowInc > 4 || currentArrowInc%4==0) {
positionDrag(dragPosition + currentArrowDirection * mouseWheelMultiplier);
}
currentArrowInc ++;
};
var onArrowMouseUp = function(event)
{
$('html').unbind('mouseup', onArrowMouseUp);
currentArrowButton.removeClass('jScrollActiveArrowButton');
clearInterval(currentArrowInterval);
};
var onArrowMouseDown = function() {
$('html').bind('mouseup', onArrowMouseUp);
currentArrowButton.addClass('jScrollActiveArrowButton');
currentArrowInc = 0;
whileArrowButtonDown();
currentArrowInterval = setInterval(whileArrowButtonDown, 100);
};
$container
.append(
$('<a></a>')
.attr({'href':'javascript:;', 'className':'jScrollArrowUp'})
.css({'width':settings.scrollbarWidth+'px'})
.html('Scroll up')
.bind('mousedown', function()
{
currentArrowButton = $(this);
currentArrowDirection = -1;
onArrowMouseDown();
this.blur();
return false;
})
.bind('click', rf),
$('<a></a>')
.attr({'href':'javascript:;', 'className':'jScrollArrowDown'})
.css({'width':settings.scrollbarWidth+'px'})
.html('Scroll down')
.bind('mousedown', function()
{
currentArrowButton = $(this);
currentArrowDirection = 1;
onArrowMouseDown();
this.blur();
return false;
})
.bind('click', rf)
);
var $upArrow = $('>.jScrollArrowUp', $container);
var $downArrow = $('>.jScrollArrowDown', $container);
if (settings.arrowSize) {
trackHeight = paneHeight - settings.arrowSize - settings.arrowSize;
$track
.css({'height': trackHeight+'px', top:settings.arrowSize+'px'})
} else {
var topArrowHeight = $upArrow.height();
settings.arrowSize = topArrowHeight;
trackHeight = paneHeight - topArrowHeight - $downArrow.height();
$track
.css({'height': trackHeight+'px', top:topArrowHeight+'px'})
}
}
var $pane = $(this).css({'position':'absolute', 'overflow':'visible'});
var currentOffset;
var maxY;
var mouseWheelMultiplier;
var dragPosition = 0;
var dragMiddle = percentInView*paneHeight/2;
var getPos = function (event, c) {
var p = c == 'X' ? 'Left' : 'Top';
return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0;
};
var ignoreNativeDrag = function() {	return false; };
var initDrag = function()
{
ceaseAnimation();
currentOffset = $drag.offset(false);
currentOffset.top -= dragPosition;
maxY = trackHeight - $drag[0].offsetHeight;
mouseWheelMultiplier = 2 * settings.wheelSpeed * maxY / contentHeight;
};
var onStartDrag = function(event)
{
initDrag();
dragMiddle = getPos(event, 'Y') - dragPosition - currentOffset.top;
$('html').bind('mouseup', onStopDrag).bind('mousemove', updateScroll);
if ($.browser.msie) {
$('html').bind('dragstart', ignoreNativeDrag).bind('selectstart', ignoreNativeDrag);
}
return false;
};
var onStopDrag = function()
{
$('html').unbind('mouseup', onStopDrag).unbind('mousemove', updateScroll);
dragMiddle = percentInView*paneHeight/2;
if ($.browser.msie) {
$('html').unbind('dragstart', ignoreNativeDrag).unbind('selectstart', ignoreNativeDrag);
}
};
var positionDrag = function(destY)
{
destY = destY < 0 ? 0 : (destY > maxY ? maxY : destY);
dragPosition = destY;
$drag.css({'top':destY+'px'});
var p = destY / maxY;
$pane.css({'top':((paneHeight-contentHeight)*p) + 'px'});
$this.trigger('scroll');
if (settings.showArrows) {
$upArrow[destY == 0 ? 'addClass' : 'removeClass']('disabled');
$downArrow[destY == maxY ? 'addClass' : 'removeClass']('disabled');
}
};
var updateScroll = function(e)
{
positionDrag(getPos(e, 'Y') - currentOffset.top - dragMiddle);
};
var dragH = Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2), settings.dragMaxHeight), settings.dragMinHeight);
$drag.css(
{'height':dragH+'px'}
).bind('mousedown', onStartDrag);
var trackScrollInterval;
var trackScrollInc;
var trackScrollMousePos;
var doTrackScroll = function()
{
if (trackScrollInc > 8 || trackScrollInc%4==0) {
positionDrag((dragPosition - ((dragPosition - trackScrollMousePos) / 2)));
}
trackScrollInc ++;
};
var onStopTrackClick = function()
{
clearInterval(trackScrollInterval);
$('html').unbind('mouseup', onStopTrackClick).unbind('mousemove', onTrackMouseMove);
};
var onTrackMouseMove = function(event)
{
trackScrollMousePos = getPos(event, 'Y') - currentOffset.top - dragMiddle;
};
var onTrackClick = function(event)
{
initDrag();
onTrackMouseMove(event);
trackScrollInc = 0;
$('html').bind('mouseup', onStopTrackClick).bind('mousemove', onTrackMouseMove);
trackScrollInterval = setInterval(doTrackScroll, 100);
doTrackScroll();
};
$track.bind('mousedown', onTrackClick);
$container.bind(
'mousewheel',
function (event, delta) {
initDrag();
ceaseAnimation();
var d = dragPosition;
positionDrag(dragPosition - delta * mouseWheelMultiplier);
var dragOccured = d != dragPosition;
return !dragOccured;
}
);
var _animateToPosition;
var _animateToInterval;
function animateToPosition()
{
var diff = (_animateToPosition - dragPosition) / settings.animateStep;
if (diff > 1 || diff < -1) {
positionDrag(dragPosition + diff);
} else {
positionDrag(_animateToPosition);
ceaseAnimation();
}
}
var ceaseAnimation = function()
{
if (_animateToInterval) {
clearInterval(_animateToInterval);
delete _animateToPosition;
}
};
var scrollTo = function(pos, preventAni)
{
if (typeof pos == "string") {
$e = $(pos, $this);
if (!$e.length) return;
pos = $e.offset().top - $this.offset().top;
}
$container.scrollTop(0);
ceaseAnimation();
var destDragPosition = -pos/(paneHeight-contentHeight) * maxY;
if (preventAni || !settings.animateTo) {
positionDrag(destDragPosition);
} else {
_animateToPosition = destDragPosition;
_animateToInterval = setInterval(animateToPosition, settings.animateInterval);
}
};
$this[0].scrollTo = scrollTo;
$this[0].scrollBy = function(delta)
{
var currentPos = -parseInt($pane.css('top')) || 0;
scrollTo(currentPos + delta);
};
initDrag();
scrollTo(-currentScrollPosition, true);
$('*', this).bind(
'focus',
function(event)
{
var $e = $(this);
var eleTop = 0;
while ($e[0] != $this[0]) {
eleTop += $e.position().top;
$e = $e.offsetParent();
}
var viewportTop = -parseInt($pane.css('top')) || 0;
var maxVisibleEleTop = viewportTop + paneHeight;
var eleInView = eleTop > viewportTop && eleTop < maxVisibleEleTop;
if (!eleInView) {
var destPos = eleTop - settings.scrollbarMargin;
if (eleTop > viewportTop) { // element is below viewport - scroll so it is at bottom.
destPos += $(this).height() + 15 + settings.scrollbarMargin - paneHeight;
}
scrollTo(destPos);
}
}
)
if (location.hash) {
scrollTo(location.hash);
}
$(document).bind(
'click',
function(e)
{
$target = $(e.target);
if ($target.is('a')) {
var h = $target.attr('href');
if (h.substr(0, 1) == '#') {
scrollTo(h);
}
}
}
);
$.jScrollPane.active.push($this[0]);
} else {
if (settings.showAlwaysBars)
{
var $container = $this.parent();
$container.append(
$('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append(
$('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append(
$('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),
$('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'})
)
)
);
} else
{
$this.css(
{
'height':paneHeight+'px',
'width':paneWidth-this.originalSidePaddingTotal+'px',
'padding':this.originalPadding
}
);
}
$this.parent().unbind('mousewheel');
}
}
)
};
$.fn.jScrollPane.defaults = {
scrollbarWidth : 10,
scrollbarMargin : 5,
wheelSpeed : 18,
showArrows : false,
arrowSize : 0,
animateTo : false,
dragMinHeight : 1,
dragMaxHeight : 99999,
animateInterval : 100,
animateStep: 3,
maintainPosition: true,
scrollbarOnLeft: false,
reinitialiseOnImageLoad: false,
showAlwaysBars: false,
positionStartY: 0
};
$(window)
.bind('unload', function() {
var els = $.jScrollPane.active;
for (var i=0; i<els.length; i++) {
els[i].scrollTo = els[i].scrollBy = null;
}
}
);
})(jQuery);
var pathImage = "/extension/donnamoderna/design/donnamoderna/images/";
var loaderImage = pathImage+"loadingAnimation.gif";
var TB_ajaxContent="slidecontainer";
var autoplaytimer=null;
var posizionescroll=null;
var inizioScroll=335;
var viewportheight = 0;
function initialCap(text) {
return text.substr(0, 1).toUpperCase() + text.substr(1);
}
function fashion_tb_show(setupID,objectSfilataID,mode,pos,color) {
try {
if (typeof document.body.style.maxHeight === "undefined") {//se ie6
jQuery("body","html").css({height: "100%", width: "100%"});
jQuery("html").css("overflow","hidden");
if (document.getElementById("TB_HideSelect") === null) {//iframe per nascondere le combo(<select>) in ie6
jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
jQuery("#TB_overlay").click(tb_remove);
}
}else{//non ie6
if(document.getElementById("TB_overlay") === null){
jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
jQuery("#TB_overlay").click(tb_remove);
}
}
if(tb_detectMacXFF()){
jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay per nascondere i flash
}else{
jQuery("#TB_overlay").addClass("TB_overlayBG");//use background e opacity
}
if (typeof(mode) == "undefined" || mode==""){
mode='slide';
}
var pagina = 0;
var params=setupID+"::"+objectSfilataID+"::"+pos+"::"+mode+"::"+pagina;
if (mode=='autoplay'){
params = params + "::true";
}
colore = "";//default nero
if (color==0){
colore = "bianco";
}
var caption = "";
showLoader();
var modalClass;
TB_WIDTH = 1500; //defaults to 630 if no paramaters were added to URL
TB_HEIGHT = jQuery(window).height(); // viewport height (altezza area visibile nel browser)
ajaxContentW = TB_WIDTH - 30;
ajaxContentH = 800 - 45;
if(jQuery("#TB_window").css("display") != "block"){
if(params['modal'] != "true"){
modalCalss='';
}else{
jQuery("#TB_overlay").unbind();
modalCalss= "TB_modal";
}
}else{
jQuery("#"+TB_ajaxContent)[0].style.width = ajaxContentW +"px";
jQuery("#"+TB_ajaxContent)[0].style.height = ajaxContentH +"px";
jQuery("#"+TB_ajaxContent)[0].scrollTop = 0;
if(params['modal'] != "true"){
jQuery("#TB_ajaxWindowTitle").html(caption);
}
}
var command = "";
var YourName = "";
var YourEmail = "";
var ReceiversName = "";
var ReceiversEmail = "";
var Subject = "";
var Comment = "";
var mailParams=objectSfilataID+"::"+command+"::"+YourName+"::"+YourEmail+"::"+ReceiversName+"::"+ReceiversEmail+"::"+Subject+"::"+Comment+"::"+setupID;
var mailParamsSlide = mailParams + "::slide::"+ pos;
var mailParamsVideo = mailParams + "::video::"+ pos;
var mailParamsThumb = mailParams + "::thumb::"+ pos;
jQuery("#TB_window").append('<div id="click_adv" style="height:90px;display:block;width:100%;margin:0;padding:0"></div>');
jQuery("#TB_window").append('<div id="TB_adv"></div>');
jQuery("#TB_window").css('margin', '0');
jQuery("#TB_window").css('padding', '0');
jQuery("#TB_window").css('background-position', 'center bottom');
jQuery("#TB_window").css('background-repeat', 'no-repeat');
jQuery("#TB_window").css('background-color', 'transparent');
jQuery("#TB_window").css('width', TB_WIDTH + ' px');
jQuery("#TB_window").css('height', TB_HEIGHT + ' px');
jQuery("#TB_adv").append("<div id='photoslider' style='height:490px;'></div>");
jQuery("#TB_adv").append('<div style="height:40px;display:block;width:100%"></div>');
jQuery("#photoslider").append("<div id='imageup' style='display:none'></div>");
jQuery("#photoslider").append("<div id='TB_title' class='sfilata-bcrumb column' style='height:34px'>"+
"<h3 id='TB_ajaxWindowTitle' class='column' style='margin:0px 0px 0px 0px;'>"+caption+"</h3> " + "<span id='thumbtitle' class='ico-thumb column "+ colore +"' style='display:none'>THUMBNAIL</span>"+
"<span id='TB_backAjaxWindow' class='column'><a id='TB_backWindowButton' href='javascript:void(0);' class='cbox_close'>BACK</a></span>"+
"<span id='TB_closeAjaxWindow' class='close-win column'>|&nbsp;<a id='TB_closeWindowButton' href='javascript:void(0);' class='cbox_close'>X</a></span>" +
"<div class='defloater'><!-- defloater --></div>" +
"</div>");
jQuery("#photoslider").append("<div id='"+TB_ajaxContent+"' class='"+colore+" "+modalCalss+"' style='float:left'></div>");
var cm_slide = "<a class='cm-email' style='display:none' href='javascript:void(0)' onclick='tipAFriend(\""+mailParamsSlide+"\")' title='EMAIL'><img src='"+pathImage+"sfilate-email.gif' alt='EMAIL' width='60' height='20' /></a>";
var cm_thumb = "<a class='cm-email' style='display:none' href='javascript:void(0)' onclick='tipAFriend(\""+mailParamsThumb+"\")' title='EMAIL'><img src='"+pathImage+"sfilate-email.gif' alt='EMAIL' width='60' height='20' /></a>";
var cm_video = "<a class='cm-email' style='display:none' href='javascript:void(0)' onclick='tipAFriend(\""+mailParamsVideo+"\")' title='EMAIL'><img src='"+pathImage+"sfilate-email.gif' alt='EMAIL' width='60' height='20' /></a>";
jQuery("#photoslider").append( "<div style='width:100%;background-color:black;padding-top:10px;padding-bottom:10px;float:right'><ul id='overlaybuttonbar' class='sfilate-options'>"+
"<li id='social-bar' style=''></li>"+
"<li id='command_email'>"+cm_slide+cm_thumb+cm_video+"</li>"+
"<li id='command_slideshow' style='display:none'><a href='javascript:void(0)' onclick='goSlideshow(\""+params+"\")' title='GALLERY'><img src='"+pathImage+"sfilate-gallery.gif' alt='SLIDESHOW' width='77' height='20' /></a></li>"+
"<li id='command_thumbnails'><a href='javascript:void(0)' onclick='goThumbnails(\""+params+"\")' title='THUMBNAILS'><img src='"+pathImage+"sfilate-thumbs.gif' alt='THUMBNAILS' width='110' height='20' /></a></li>"+
"<li id='command_video' style='display:none'><a href='javascript:void(0)' onclick='goVideo(\""+params+"\")' title='VIDEO'><img src='"+pathImage+"sfilate-video.gif' alt='VIDEO' width='46' height='20' /></a></li>"+
"</ul><div id='overlaybuttonbardefloater' class='defloater'></div><!-- defloater --></div>");
jQuery("#social-bar").append('<div id="social-oknotizie"></div>');
jQuery("#social-bar").append('<div id="social-fb-like"></div>');
jQuery("#social-bar").append('<div id="social-twitter"></div>');
jQuery("#photoslider").append("<div id='imagedown' style='display:none'></div>");
jQuery("#TB_closeWindowButton").click(tb_remove);
jQuery("#TB_backWindowButton").click(function(){goSlideshow(params);});
if((typeof(mode) == "undefined") || (mode=='slide') || (mode=='autoplay')){
goSlideshow(params);
}else if (mode=='thumb'){
goThumbnails(params);
}else if(mode=='video'){
goVideo(params);
}
if(!params['modal']){
document.onkeyup = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
tb_remove();
}
};
}
} catch(e) {
}
}
function goThumbnails(params){
trackCall('sfilate','viewer');
gTrackCall('sfilate','viewer');
showLoader();
clearInterval(autoplaytimer);
if (!jQuery('#TB_title').hasClass('thumb-bcrumb')){
jQuery('#TB_title').addClass('thumb-bcrumb');
}
if (!jQuery('#TB_title').hasClass('thumb-column')){
jQuery('#TB_title').addClass('column');
}
jQuery('#'+TB_ajaxContent).css('padding','0px');
jQuery('#'+TB_ajaxContent).css('margin','0px 0px 0px 0px');
jQuery('#TB_backAjaxWindow').css('margin','14px 0px 0px 42px');
jQuery('#TB_backAjaxWindow').show();
jQuery('#thumbtitle').show();
jQuery('#overlaybuttonbar').hide();
jQuery('.cm-email').eq(0).hide();
jQuery('.cm-email').eq(1).show();
jQuery('.cm-email').eq(2).hide();
jQuery.ez( "fashion::open::thumbnails::"+params , {postData: ''} , _overlaycallBack );
}
function goSlideshow(params){
showLoader();
clearInterval(autoplaytimer);
if (jQuery('#TB_title').hasClass('thumb-bcrumb')){
jQuery('#TB_title').removeClass('thumb-bcrumb');
}
if (jQuery('#TB_title').hasClass('thumb-column')){
jQuery('#TB_title').removeClass('column');
}
jQuery('#'+TB_ajaxContent).css('padding','0px 0px 0px 0px');
jQuery('#'+TB_ajaxContent).css('margin','0px 0px 0px 0px');
jQuery('#thumbtitle').hide();
jQuery('#TB_backAjaxWindow').hide();
jQuery('#overlaybuttonbar').show();
jQuery('.cm-email').eq(0).show();
jQuery('.cm-email').eq(1).hide();
jQuery('.cm-email').eq(2).hide();
jQuery.ez( "fashion::open::slideshow::"+params , {postData: ''} , _overlaycallBack );
}
function goVideo(params){
trackCall('sfilate','viewer');
gTrackCall('sfilate','viewer');
showLoader();
clearInterval(autoplaytimer);
if (jQuery('#TB_title').hasClass('thumb-bcrumb')){
jQuery('#TB_title').removeClass('thumb-bcrumb');
}
if (jQuery('#TB_title').hasClass('thumb-column')){
jQuery('#TB_title').removeClass('column');
}
jQuery('#'+TB_ajaxContent).css('padding','0px 0px 0px 10px');
jQuery('#'+TB_ajaxContent).css('margin','0px 0 0');
jQuery('#thumbtitle').hide();
jQuery('#TB_backAjaxWindow').hide();
jQuery('#overlaybuttonbar').show();
jQuery('.cm-email').eq(0).hide();
jQuery('.cm-email').eq(1).hide();
jQuery('.cm-email').eq(2).show();
jQuery.ez( "fashion::open::video::" + params , {postData: ''} , _overlaycallBack );
}
function replaceMode(params,mode){
params = jQuery.URLDecode(params);
var par = params.split("::");
var par_url=par[par.length-1].split('/(m)/');
var url = "";
var i=0;
for(i=0;i<par.length-1;i++){
url += par[i] + "::";
}
url += jQuery.URLEncode(jQuery.URLEncode(par_url[0] + "/(m)/" + mode));
return url;
}
function tipAFriend(params){
showLoader();
clearInterval(autoplaytimer);
jQuery('#'+TB_ajaxContent).css('padding','10px 0px');
jQuery('#'+TB_ajaxContent).css('margin','5px 0 0');
jQuery('#thumbtitle').hide();
jQuery('#TB_backAjaxWindow').hide();
jQuery('#overlaybuttonbar').show();
jQuery.ez("fashion::tipafriend::" + params  , {postData: ''} , _overlaycallBack );
}
function imu(){
jQuery.ez( "fashion::imu" , {postData: ''} );
}
function showLoader(){
jQuery("body").append("<div id='TB_load'><img src='"+ loaderImage + "' /></div>");
jQuery('#TB_load').show();
}
function hideLoader(){
jQuery('#TB_load').remove();
}
function tb_showIframe(){
hideLoader();
jQuery("#TB_window").css({display:"block"});
}
function tb_remove() {
jQuery("#TB_imageOff").unbind("click");
jQuery("#TB_closeWindowButton").unbind("click");
jQuery("#TB_backWindowButton").unbind("click");
jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
hideLoader();
if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
jQuery("body","html").css({height: "auto", width: "auto"});
jQuery("html").css("overflow","");
}
document.onkeydown = "";
document.onkeyup = "";
clearInterval(autoplaytimer);
return false;
}
function tb_position() {
jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
}
}
function tb_parseQuery ( query ) {
var Params = {};
if ( ! query ) {return Params;}// return empty object
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split('=');
if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ' ');
Params[key] = val;
}
return Params;
}
function tb_getPageSize(){
var de = document.documentElement;
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
arrayPageSize = [w,h];
return arrayPageSize;
}
function tb_detectMacXFF() {
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
return true;
}
}
function _overlaycallBack( data ){
clearInterval(autoplaytimer);
tb_position();
tb_showIframe();
if ( data && data.content !== '' ){
if ( data.content.result ){
jQuery('#'+TB_ajaxContent).html(data.content.result);
}
}
else{alert( data.content.error_text );}
}
var contaADV = 0;
var whatpage;
var gruppo;
var posizione;
var vocemenu;
var totallinks;
var prevpage = 0;
var nextpage = 0;
function mostraSubmenu(gruppo,posizione) {
currentsubmenu = gruppo;
jQuery('li.submenu-brand ul').slideUp();
jQuery('li.submenu-brand ul.'+gruppo).slideDown();
setTimeout('resizescroll()',500);
vocemenu = 1;
jQuery('.submenu-brand ul li a').removeClass("selected");
jQuery('.submenu-brand ul.'+gruppo+' li a:eq(0)').addClass("selected");
jQuery('.submenu-brand ul li').removeClass("selected");
jQuery('.submenu-brand ul.'+gruppo+' li:eq(0)').addClass("selected");
jQuery('#brandcarousel li.pic a').removeClass("current");
jQuery('#brandcarousel li.pic a:eq('+posizione+')').addClass("current");
}
function resizescroll() {
jQuery('#pane1').jScrollPane({scrollbarWidth:20, dragMaxHeight:15, showAlwaysBars:true});
}
function loadpage(whatpage, numpage) {
vocemenu = numpage;
totallinks = (jQuery('li.submenu-brand ul.'+currentsubmenu+' li').length)-1;
jQuery('#in-fashion').load(whatpage).hide().fadeIn(500);
jQuery(".submenu-brand ul li a").removeClass("selected");
jQuery('.submenu-brand ul li a:eq('+(vocemenu)+')').addClass("selected");
jQuery(".submenu-brand ul li").removeClass("selected");
jQuery('.submenu-brand ul li:eq('+(vocemenu)+')').addClass("selected");
if (vocemenu >= totallinks) { // sono all'ultima pagina
jQuery('#navnext').fadeOut;
}
if (vocemenu <= 2) { // sono alla prima pagina
jQuery('#navprev').hide;
}
contaADV++
if (contaADV==5) { showADV(); }
}
function navigatePrev() {
prevpage = 	vocemenu-1;
if (!vocemenu || vocemenu >= totallinks) {
closepage();
}
else {
jQuery('[rel='+prevpage+']').trigger('click');
}
}
function navigateNext() {
nextpage = (vocemenu-0)+1;
if (vocemenu >= totallinks) {
closepage();
}
else {
jQuery('[rel='+nextpage+']').trigger('click');
}
}
function showADV() {
jQuery('#adv').fadeIn(500);
jQuery('#veloadv').show();
jQuery('#adv').html('<p class="loading"><img src="images/ajax-loader.gif" width="16" height="16" />LOADING...</p>');
jQuery('#adv').load('profili/advloader.html');
contaADV=0;
}
function closeADV() {
jQuery('#adv').fadeOut(500);
jQuery('#veloadv').hide();
}
function closepage() { // bottone [CLOSE X]
jQuery('#in-fashion').hide();
mostraSubmenu('');
}
function currentStagione(gruppo,posizione) {
jQuery('#stagione li').removeClass("current");
jQuery('#stagione li:eq('+posizione+')').addClass("current");
}
function currentLuogo(gruppo,posizione) {
jQuery('#luogo li ').removeClass("current");
jQuery('#luogo li:eq('+posizione+')').addClass("current");
}
function currentStilista(gruppo,posizione) {
jQuery('#stilista li ').removeClass("current");
jQuery('#stilista li:eq('+posizione+')').addClass("current");
}
function mycarousel_initCallback(carousel) {
jQuery('.jcarousel-control a').bind('click', function() {
carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
return false;
});
jQuery('#mycarousel-next').bind('click', function() {
carousel.next();
return false;
});
jQuery('#mycarousel-prev').bind('click', function() {
carousel.prev();
return false;
});
};
(function($) {
jQuery.fn.extend({
getUrlParam: function(strParamName){
strParamName = escape(unescape(strParamName));
var returnVal = new Array();
var qString = null;
if ($(this).attr("nodeName")=="#document") {
if (window.location.search.search(strParamName) > -1 ){
qString = window.location.search.substr(1,window.location.search.length).split("&");
}
} else if ($(this).attr("src")!="undefined") {
var strHref = $(this).attr("src")
if ( strHref.indexOf("?") > -1 ){
var strQueryString = strHref.substr(strHref.indexOf("?")+1);
qString = strQueryString.split("&");
}
} else if ($(this).attr("href")!="undefined") {
var strHref = $(this).attr("href")
if ( strHref.indexOf("?") > -1 ){
var strQueryString = strHref.substr(strHref.indexOf("?")+1);
qString = strQueryString.split("&");
}
} else {
return null;
}
if (qString==null) return null;
for (var i=0;i<qString.length; i++){
if (escape(unescape(qString[i].split("=")[0])) == strParamName){
returnVal.push(qString[i].split("=")[1]);
}
}
if (returnVal.length==0) return null;
else if (returnVal.length==1) return returnVal[0];
else return returnVal;
}
});
})(jQuery);
(function ($) {
var num = function (value) {
return parseInt(value, 10) || 0;
};
$.each(['min', 'max'], function (i, name) {
$.fn[name + 'Size'] = function (value) {
var width, height;
if (value) {
if (value.width) {
this.css(name + '-width', value.width);
}
if (value.height) {
this.css(name + '-height', value.height);
}
return this;
}
else {
width = this.css(name + '-width');
height = this.css(name + '-height');
return {'width': (name === 'max' && (width === undefined || width === 'none' || num(width) === -1) && Number.MAX_VALUE) || num(width),
'height': (name === 'max' && (height === undefined || height === 'none' || num(height) === -1) && Number.MAX_VALUE) || num(height)};
}
};
});
$.fn.isVisible = function () {
return this.css('visibility') !== 'hidden' && this.css('display') !== 'none';
};
$.each(['border', 'margin', 'padding'], function (i, name) {
$.fn[name] = function (value) {
if (value) {
if (value.top) {
this.css(name + '-top' + (name === 'border' ? '-width' : ''), value.top);
}
if (value.bottom) {
this.css(name + '-bottom' + (name === 'border' ? '-width' : ''), value.bottom);
}
if (value.left) {
this.css(name + '-left' + (name === 'border' ? '-width' : ''), value.left);
}
if (value.right) {
this.css(name + '-right' + (name === 'border' ? '-width' : ''), value.right);
}
return this;
}
else {
return {top: num(this.css(name + '-top' + (name === 'border' ? '-width' : ''))),
bottom: num(this.css(name + '-bottom' + (name === 'border' ? '-width' : ''))),
left: num(this.css(name + '-left' + (name === 'border' ? '-width' : ''))),
right: num(this.css(name + '-right' + (name === 'border' ? '-width' : '')))};
}
};
});
})(jQuery);
( function($) {
$.widget("ui.amecarosel", {
_init : function() {
var self = this, o = this.options;
this.pos = 0;
this.items_width = 0;
this.element.addClass("ame-amecarosel");
this.autoplay = o.autoplay;
this.parent_left = this.element.offset().left;
this.width = this.element.width();
this.items = $("> div", this.element).remove();
this.items_length = self.items.length;
this.container = $('<div />').addClass("ame-amecarosel-container");
this.container.offset = 0;
this.element.append(this.container);
this.items
.each( function(i) {
this.num = i;
self.container.append($(this).addClass(
"ame-amecarosel-item"));
this.item_width = $(this).outerWidth()
+ $(this).margin().left
+ $(this).margin().right
+ $(this).padding().left
+ $(this).padding().right;
this.extra = (self.width - this.item_width) / 2
self.items_width += this.item_width;
this.advplay = true;
this.viewWithoutPageView = function() {
self.pos = this.num;
var left = -self.parent_left
+ $(this).offset().left;
var item_offset = -left + $(this).margin().left
+ $(this).padding().left + this.extra;
if (this.num == self.items_length - 1) {
self.container.offset = -(self.items_width
- self.width + this.extra);
item_offset = 0;
} else if (this.num == 0) {
self.container.offset = 0;
item_offset = 0 + this.extra;
}
self.container.offset += item_offset;
self.container.animate( {
marginLeft : self.container.offset + 'px'
}, 300);
if ($(this).is('.timer-adv') && this.advplay) {
if (!self.autoplay) {
$(this).sleep(7000, function() {
self.nextAutoplay();
});
}
this.advplay = false;
}
if (self.autoplay) {
$(this).sleep(7000, function() {
self.nextAutoplay();
});
}
}
this.view = function() {
this.viewWithoutPageView();
self._trigger("page_view", this.pos);
}
$(self.items[this.num]).click( function(e) {
this.autoplay = false;
if (this.num != self.pos) {
this.view();
return false;
} else
return true;
});
});
if (o.value > -1 && this.items.length > 0)
this.items[o.value].view();
},
value : function(newValue) {
if (arguments.length == 0)
return this.pos;
this.autoplay = false;
$(this.items[this.pos]).stop();
this.pos = newValue;
if (this.pos < 0)
this.pos = 0;
if (this.pos > this.items.length - 1)
this.pos = this.items.length - 1;
this.items[this.pos].view();
return this;
},
length : function() {
return this.items.length;
},
next : function() {
this.autoplay = false;
$(this.items[this.pos]).stop();
if (this.pos == (this.items.length - 1)) {
this.pos = 0;
} else {
this.pos += 1;
}
this.items[this.pos].view();
},
nextAutoplay : function() {
if (this.pos == (this.items.length - 1)) {
this.pos = 0;
} else {
this.pos += 1;
}
this.items[this.pos].viewWithoutPageView();
},
previous : function() {
this.autoplay = false;
$(this.items[this.pos]).stop();
if (this.pos > 0) {
this.pos -= 1;
} else {
this.pos = this.items.length - 1;
}
this.items[this.pos].view();
}
});
$.extend($.ui.amecarosel, {
getter : "value length",
defaults : {
value : 0,
autoplay : false
}
});
jQuery.fn.sleep = function sleep(time, callback) {
this.animate( {
opacity : 1.0
}, time, callback);
}
})(jQuery);
(function($) {
$.widget("ui.amedossier", {
_init: function() {
var self = this, o = this.options;
self.pos = -1;
self.triggered = o.triggered;
this.divs = $("div", this.element).remove();
this.links = new Array();
this.imagesContainer = $('<div />').addClass("ame-amedossier-container-images");
this.element.append(this.imagesContainer);
var linksContainer = $('<div />').addClass("ame-amedossier-container-links");
linksContainer.append($("> h3", $('#tabs')).remove());
this.ulLinks = $('<ul />').addClass("ame-amedossier-links");
linksContainer.append(this.ulLinks);
this.element.append(linksContainer);
this.x_dossier = $('<div />').addClass("x-dossier").append('X');
this.imagesContainer.append(self.x_dossier);
jQuery('.ame-amedossier-container-links > h3').show();
this.divs.each(function(i) {
self.links[i] = $('a',this).addClass("ame-amedossier-link")[0];
$('a',this).attr('id','dossierdx_'+i);
self.links[i].num = i;
self.ulLinks.append($('<li />').append(self.links[i]));
self.links[i].image = $('<div id="dossiersx_'+i+'" />').addClass("ame-amedossier-image");
self.links[i].image.append($('<a href="'+jQuery(self.links[i]).attr('href')+'"/>').append($('img',this)[0]));
self.imagesContainer.append(self.links[i].image);
self.links[i].image.css('z-index', self.divs.length - i - 1);
self.links[i].view = function(e) {
if (self.pos != this.num) {
if (self.pos >= 0 && self.pos < self.links.length) {
$(self.links[self.pos]).removeClass('ame-amedossier-link-selected');
$(self.links[self.pos]).css('color','black');
$(self.links[self.pos].image).css('display','none');
$(self.links[self.pos].image).removeClass('ame-amedossier-image-selected');
if (self.pos+1 < self.links.length) $(self.links[self.pos+1].image).css('display','none');
}
self.pos = this.num;
$(this).addClass('ame-amedossier-link-selected');
$(this).css('color','white');
$(this.image).css('display','block');
$(this.image).addClass('ame-amedossier-image-selected');
$(this.image).css('top', ('-25px'));
if (self.pos+1 < self.links.length) {
$(self.links[self.pos+1].image).css('display','block');
$(self.links[self.pos+1].image).css('top', ('-335px'));
}
if($(this).is('.timer-adv') && $('#tabs-2').css("display") != 'none') {
$(this).sleep(7000, function() {document.location = "?tab=0"});
}
self._trigger("page_view");
self.triggered = false;
}
else self.triggered=true;
return self.triggered;
}
$(self.links[i].image).click(function(e) {
var iddx= jQuery(this).attr('id');
var idsx=iddx.substring(10,iddx.length);
var tagsx = jQuery('#dossierdx_'+idsx);
var ret= tagsx.trigger('click');
return self.triggered;
});
$(self.links[i]).click(function(e) {
$(self.links[self.pos]).stop();
return this.view(e);
});
});
$(this.x_dossier).click(function(e) {
self.next();
return false;
});
if (self.links.length > 0) self.links[o.value].view();
},
value: function(newValue) {
if (arguments.length == 0) return this.pos;
this.pos=newValue;
if (this.pos < 0) this.pos = 0;
if (this.pos > this.links.length - 1) this.pos = this.links.length - 1;
this.links[this.pos].view();
return this;
},
next: function() {
$(this.links[this.pos]).stop();
if (this.pos == this.links.length - 1) {
this.links[0].view();
}
else {
this.links[this.pos+1].view();
}
return this;
}
});
$.extend($.ui.amedossier, {
getter: "value",
version: "@VERSION",
triggered: false,
defaults: {
value: 0
}
});
jQuery.fn.sleep = function sleep(time, callback) {
this.animate({opacity:1.0}, time, callback);
}
})(jQuery);
var attivita_sports= ["golf","ciclismo","pallavolo","nuoto","tennis singolo","tennis doppio","corsa campestre","calcio","calcetto","sci","pallamano" ,"pallacanestro","pugilato","maratona","rugby"];
var blando= [5.2,5.9,8.5,9.1,13,9.1,10.4,11.7,15,12,13.7,14.3,15,20,8.3];
var intenso =  [5.2,26,10,25,22,20,20,15,20,21.5,15,18,17,23,12];
var attivita_vita =  ["cucire","lavorare a maglia","pulire i pavimenti","lavare i vetri","stirare","pulire i tappeti","preparare il pasto ","rifare il letto","lavare i piatti","spolverare","spostare i mobili"];
var infoCalorie = [6,6,9,9,9,12,12,9,2.4,3,6];
var ritmo= ["","blando","intenso"];
var stile= ["","vita sportiva","vita quotidiana"];
var minuti= [[0,' '],[5,'5 minuti'],[10,'10 minuti'],[15,'15 minuti'],[30,'30 minuti'],[45,'45 minuti'],[60,'1 ora'],[120,'2 ore'],[180,'3 ore'],[240,'4 ore']];
var attivita;
function trovaStringa(arr, s)	{
var indice=0;
for(var i=0;i<arr.length;i++)
if(arr[i]==s)
{
indice=i;
break;
}
return indice;
}
function initContacalorie()
{
jQuery('#pRitmo').hide();
aggiungiOptions(stile,"#stile")
aggiungiOptions(ritmo,"#ritmo")
var i=0;
for(i=0;i<minuti.length;i++)
{
jQuery("#minuti").
append(jQuery("<option></option>").
attr("value",minuti[i][0]).
text(minuti[i][1]));
}
aggiungiOptions([""],"#attivita")
}
function aggiungiOptions(vettore,id)
{
var i=0;
for(i=0;i<vettore.length;i++)
{
jQuery(id).
append(jQuery("<option></option>").
attr("value",vettore[i]).
text(vettore[i]));
}
}
function aggiornaAttivita() {
jQuery('#attivita').html("");
aggiungiOptions([""],"#attivita")
jQuery('#pRitmo').hide();
var stileselezionato=jQuery("#stile").val();
if (stileselezionato=='vita sportiva')
{
attivita = attivita_sports;
aggiungiOptions(attivita_sports,"#attivita")
jQuery('#pRitmo').show();
} else if (stileselezionato=='vita quotidiana') {
attivita = attivita_vita;
aggiungiOptions(attivita_vita,"#attivita")
}
}
function calcolaCalorie()
{
var calorie=0.0;
var pos= trovaStringa(jQuery("#attivita").val());
var stileselezionato=jQuery("#stile").val();
if (stileselezionato=='vita quotidiana') {
calorie = infoCalorie[pos];
} else
{
var ritmoselezionato=jQuery("#ritmo").val();
if(ritmoselezionato=="blando")
{
calorie=blando[pos];
}
else
{
calorie=intenso[pos];
}
}
return calorie;
}
function validation() {
return ((jQuery("#minuti").val()>0) && jQuery("#attivita").val()!='' && (jQuery("#stile").val()=='vita quotidiana' || (jQuery("#stile").val()=='vita sportiva' && jQuery("#ritmo").val()!='') ))
}
function calcola()
{
if (validation())
{
var calorie = calcolaCalorie();
var necessita = calorie*jQuery("#minuti").val();
document.getElementById('calorie').value = calorie;
document.getElementById('necessita').value = necessita;
jQuery("#temp_contacalorie").hide();
jQuery('#attivita_contacalorie').html(jQuery("#minuti").val()+" minuti di "+jQuery("#attivita").val()+ " a ritmo "+jQuery("#ritmo").val());
jQuery('#risultato_contacalorie').html(calcolaCalorie()*jQuery("#minuti").val());
jQuery("#boxrisultato_contacalorie").show();
}
else
{
alert("Completare l'inserimento dei dati");
}
return false;
}
function bmiCalc(form)
{
var weight = Number(form.peso.value);
var height = Number(form.altezza.value);
if (!checkNum(weight,"peso"))
{
form.peso.select();
form.peso.focus();
return false
}
if (!checkNum(height,"Altezza"))
{
form.altezza.select();
form.altezza.focus();
return false
}
if (form.sesso[1].checked)
{
idealConvert = 45.5; //  fattore di conversione per sesso F
}
else
{
idealConvert = 50;	//  fattore di conversione per sesso M
}
AltezzaMetri = height / 100;
var AreaSupCorporea = 0.20247 * Math.pow(AltezzaMetri,0.725) * Math.pow(weight,0.425);
var PesIdKg = idealConvert + 2.3 * ((AltezzaMetri * 100 /2.54) - 60);
var bmi = weight / Math.pow(AltezzaMetri,2);
AreaSupCorporea = rounding(AreaSupCorporea,2);
PesIdKg = Math.round(PesIdKg);
bmi = rounding(bmi,1);
if (bmi < 18.5) {
var interp = "che sei sottopeso"
}
else {
if (bmi < 25.0) {
var interp = "un peso normale"
} else {
if (bmi < 30.0) {
var interp = "che sei sovrappeso"
} else {
var interp = "che hai problemi di obesit&agrave;"
}
}
}
jQuery("#temp_massacorporea").hide();
jQuery('#indice_massacorporea').html(bmi);
jQuery('#pesoideale').html(PesIdKg);
jQuery("#boxrisultato_massacorporea").show();
jQuery("#valutazionepeso").html(interp);
return false;
}
function checkNum(val,text) {
if ((val == null) || (isNaN(val)) || (val == "") || (val < 0))
{
alert("Inserisci in modo corretto il valore " + text + ".");
return false
}
return true;
}
function rounding(number,decimal)
{
multiplier = Math.pow(10,decimal);
number = Math.round(number * multiplier) / multiplier;
return number;
}
function dispDate(dateObj) {
month = dateObj.getMonth()+1;
month = (month < 10) ? "0" + month : month;
day   = dateObj.getDate();
day = (day < 10) ? "0" + day : day;
year  = dateObj.getYear();
if (year < 2000) year += 1900;
return (month + "/" + day + "/" + year);
}
function pregnancyCalc(pregform)
{
menstrual = new Date(); // creates new date objects
ovulation = new Date();
duedate = new Date();
today = new Date();
cycle = 0, luteal = 0; // sets variables to invalid state ==> 0
datamestruale = pregform.mese.value + '/' + pregform.giorno.value + '/' + pregform.anno.value;
menstrualinput = new Date(datamestruale);
menstrual.setTime(menstrualinput.getTime())
cycle = 28; // defaults to 28
luteal = 14; // defaults to 14
ovulation.setTime(menstrual.getTime() + (cycle*86400000) - (luteal*86400000));
conceptionH = dispDate(ovulation);
conception = conceptionH.substr(3, 2) + "/" +  conceptionH.substr(0, 2) + "/" + conceptionH.substr(6, conceptionH.length);
duedate.setTime(ovulation.getTime() + 266*86400000);
conceptionH = dispDate(duedate);
duedatefinale = conceptionH.substr(3, 2) + "/" +  conceptionH.substr(0, 2) + "/" + conceptionH.substr(6, conceptionH.length);
var fetalage = 14 + 266 - ((duedate - today) / 86400000);
weeks = parseInt(fetalage / 7); // sets weeks to whole number of weeks
days = Math.floor(fetalage % 7); // sets days to the whole number remainder
fetalage = weeks + " settimane" + (weeks > 1 ? "" : "") + " + " + days + " giorni";
if (weeks>42)
{
jQuery("#temp_quandonascera").hide();
jQuery("#gianato_quandonascera").show();
jQuery('#settimana_quandonascera').html("");
jQuery('#datanascita').html("");
jQuery("#data_quandonascera").hide();
jQuery("#errore_quandonascera").hide();
jQuery("#boxrisultato_quandonascera").show();
} else
{
if (weeks<0 || days<0)
{
jQuery('#settimana_quandonascera').html("");
jQuery("#temp_quandonascera").hide();
jQuery("#gianato_quandonascera").hide();
jQuery("#errore_quandonascera").show();
jQuery('#datanascita').html("");
jQuery("#data_quandonascera").hide();
jQuery("#boxrisultato_quandonascera").show();
}
else
{
jQuery("#temp_quandonascera").hide();
jQuery("#gianato_quandonascera").hide();
jQuery('#settimana_quandonascera').html("Complimenti! <br/>Sei in dolce attesa da "+weeks+" settimane");
jQuery("#errore_quandonascera").hide();
jQuery('#datanascita').html(duedatefinale);
jQuery("#data_quandonascera").show();
jQuery("#boxrisultato_quandonascera").show();
}
}
return false; // form should never submit, returns false
}
function scriviLettere(selezione)
{
var lettera='A';
var nCharCode=lettera.charCodeAt(0);
var stringa='';
do
{
if (lettera==selezione)
stringa+='<span class="selezione"><a href="javascript:void(0)" style="color:white" onclick="ricercaNome(\''+lettera+'\')">'+lettera+'</a></span> ';
else
stringa+='<a href="javascript:void(0)" onclick="ricercaNome(\''+lettera+'\')">'+lettera+'</a> ';
lettera=String.fromCharCode(++nCharCode);
}
while (lettera!='Z');
jQuery("#sceglinomelettere").html(stringa);
}
function ricercaNome(letteraInizio)
{
var categoria=jQuery('#categoria_search').val();
var sesso=jQuery('#sesso_search').val();
var sillabe=jQuery('#sillabe_search').val();
if (letteraInizio==null)
letteraInizio=jQuery('#inizio_search').val();
mostraWaiter();
if (categoria=="") categoria="TUTTI";
if (sesso=="") sesso="TUTTI";
if (sillabe=="") sillabe="TUTTI";
if (letteraInizio=="") letteraInizio="A";
jQuery.ez( "fashion::scegliilnome::"+categoria+"::"+sesso+"::"+sillabe+"::"+letteraInizio, {postData: ''} , _callBackNomeFiglio);
scriviLettere(letteraInizio.toUpperCase());
return false;
}
function mostraWaiter()
{
jQuery("#sceglinometemp").hide();
jQuery("#sceglinomeresult").show();
jQuery("#risultatonomefiglio").hide();
jQuery("#waiternomefiglio").show();
}
function nascondiWaiter()
{
jQuery("#risultatonomefiglio").show();
jQuery("#waiternomefiglio").hide();
}
function _callBackNomeFiglio( data ){
if ( data && data.content !== '' )
{
if ( data.content.result )
{
var stringa="";
for (i=0;i<data.content.result.length;i++)
stringa=stringa+"<span class='nomerisultato'><a href=\"javascript:void(0)\" onclick=\"apriNome('"+data.content.result[i]+"')\">"+data.content.result[i]+"</a></span><br/>";
jQuery('#risultatonomefiglio').html(stringa);
nascondiWaiter();
} else
{
alert( data.content.error_text );
nascondiWaiter();
}
}
else
{
alert( "errore sconosciuto" );
}
}
function _callBackDescrizioneNome( data ){
if ( data && data.content !== '' )
{
if ( data.content.result )
{
var stringa="";
var i=0;
stringa="<strong>"+data.content.result[i]+"</strong><p>Varianti: "+data.content.varianti[i]+"</p><p>Onomastico: "+data.content.onomastico[i]+"</p><p>Significato: "+data.content.significato[i];
stringa+="<div class='backsceglinome'><a href='javascript:void(0)' onclick='ricercaNomeEsatto(\""+data.content.result[i]+"\")'>&lt;&lt;</a></div>"
jQuery('#risultatonomefiglio').html(stringa);
nascondiWaiter();
} else
{
alert( data.content.error_text );
nascondiWaiter();
}
}
else
{
alert( "errore sconosciuto" );
}
}
function apriNome(nome)
{
jQuery.ez( "fashion::scegliilnome2::"+nome, {postData: ''} , _callBackDescrizioneNome);
scriviLettere(nome.substring(0,1).toUpperCase());
}
function ricercaNome2()
{
var nome=jQuery('#nome_search').val();
if (nome=="")
{
alert("Inserisci il nome");
return false;
}
ricercaNomeEsatto(nome);
return false;
}
function ricercaNomeEsatto(nome)
{
mostraWaiter();
jQuery.ez( "fashion::scegliilnome2::"+nome, {postData: ''} , _callBackNomeFiglio);
scriviLettere(nome.substring(0,1).toUpperCase());
return false;
}
var tb_pathToImage = "/extension/mfdtipafriend/design/standard/images/loadingAnimation.gif";
var tb_closeImage = "/extension/donnamoderna/design/donnamoderna/images/btn-tb-close.png";
jQuery(document).ready(function(){
tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
imgLoader = new Image();// preload image
imgLoader.src = tb_pathToImage;
});
function tb_init(domChunk){
jQuery(domChunk).click(function(){
var t = this.title || this.name || null;
var a = this.href || this.alt;
var g = this.rel || false;
tb_show(t,a,g);
this.blur();
return false;
});
}
function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
try {
if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
jQuery("body","html").css({height: "100%", width: "100%"});
jQuery("html").css("overflow","hidden");
if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
jQuery("#TB_overlay").click(tb_remove);
}
}else{//all others
if(document.getElementById("TB_overlay") === null){
jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
jQuery("#TB_overlay").click(tb_remove);
}
}
if(tb_detectMacXFF()){
jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
}else{
jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
}
if(caption===null){caption="";}
jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
jQuery('#TB_load').show();//show loader
var baseURL;
if(url.indexOf("?")!==-1){ //ff there is a query string involved
baseURL = url.substr(0, url.indexOf("?"));
}else{
baseURL = url;
}
var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
var urlType = baseURL.toLowerCase().match(urlString);
if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
TB_PrevCaption = "";
TB_PrevURL = "";
TB_PrevHTML = "";
TB_NextCaption = "";
TB_NextURL = "";
TB_NextHTML = "";
TB_imageCount = "";
TB_FoundURL = false;
if(imageGroup){
TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
if (!(TB_TempArray[TB_Counter].href == url)) {
if (TB_FoundURL) {
TB_NextCaption = TB_TempArray[TB_Counter].title;
TB_NextURL = TB_TempArray[TB_Counter].href;
TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
} else {
TB_PrevCaption = TB_TempArray[TB_Counter].title;
TB_PrevURL = TB_TempArray[TB_Counter].href;
TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
}
} else {
TB_FoundURL = true;
TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
}
}
}
imgPreloader = new Image();
imgPreloader.onload = function(){
imgPreloader.onload = null;
var pagesize = tb_getPageSize();
var x = pagesize[0] - 150;
var y = pagesize[1] - 150;
var imageWidth = imgPreloader.width;
var imageHeight = imgPreloader.height;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth);
imageWidth = x;
if (imageHeight > y) {
imageWidth = imageWidth * (y / imageHeight);
imageHeight = y;
}
} else if (imageHeight > y) {
imageWidth = imageWidth * (y / imageHeight);
imageHeight = y;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth);
imageWidth = x;
}
}
TB_WIDTH = imageWidth;
TB_HEIGHT = imageHeight;
jQuery("#TB_window").append("<img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='"+tb_closeImage+"' alt='' /></a></div>");
jQuery("#TB_closeWindowButton").click(tb_remove);
if (!(TB_PrevHTML === "")) {
function goPrev(){
if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
jQuery("#TB_window").remove();
jQuery("body").append("<div id='TB_window'></div>");
tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
return false;
}
jQuery("#TB_prev").click(goPrev);
}
if (!(TB_NextHTML === "")) {
function goNext(){
jQuery("#TB_window").remove();
jQuery("body").append("<div id='TB_window'></div>");
tb_show(TB_NextCaption, TB_NextURL, imageGroup);
return false;
}
jQuery("#TB_next").click(goNext);
}
document.onkeydown = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
tb_remove();
} else if(keycode == 190){ // display previous image
if(!(TB_NextHTML == "")){
document.onkeydown = "";
goNext();
}
} else if(keycode == 188){ // display next image
if(!(TB_PrevHTML == "")){
document.onkeydown = "";
goPrev();
}
}
};
tb_position();
jQuery("#TB_load").remove();
jQuery("#TB_ImageOff").click(tb_remove);
jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
};
imgPreloader.src = url;
}else{//code to show html
var queryString = url.replace(/^[^\?]+\??/,'');
var params = tb_parseQuery( queryString );
TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
ajaxContentW = TB_WIDTH - 30;
ajaxContentH = TB_HEIGHT - 45;
if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
urlNoQuery = url.split('TB_');
jQuery("#TB_iframeContent").remove();
if(params['modal'] != "true"){//iframe no modal
jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
}else{//iframe modal
jQuery("#TB_overlay").unbind();
jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
}
}else{// not an iframe, ajax
if(jQuery("#TB_window").css("display") != "block"){
if(params['modal'] != "true"){//ajax no modal
jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
}else{//ajax modal
jQuery("#TB_overlay").unbind();
jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
}
}else{//this means the window is already up, we are just loading new content via ajax
jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
jQuery("#TB_ajaxContent")[0].scrollTop = 0;
jQuery("#TB_ajaxWindowTitle").html(caption);
}
}
jQuery("#TB_closeWindowButton").click(tb_remove);
if(url.indexOf('TB_inline') != -1){
jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
jQuery("#TB_window").unload(function () {
jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
});
tb_position();
jQuery("#TB_load").remove();
jQuery("#TB_window").css({display:"block"});
}else if(url.indexOf('TB_iframe') != -1){
tb_position();
if($.browser.safari){//safari needs help because it will not fire iframe onload
jQuery("#TB_load").remove();
jQuery("#TB_window").css({display:"block"});
}
}else{
jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
tb_position();
jQuery("#TB_load").remove();
tb_init("#TB_ajaxContent a.thickbox");
jQuery("#TB_window").css({display:"block"});
});
}
}
if(!params['modal']){
document.onkeyup = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
tb_remove();
}
};
}
} catch(e) {
}
}
function tb_showIframe(){
jQuery("#TB_load").remove();
jQuery("#TB_window").css({display:"block"});
}
function tb_remove() {
jQuery("#TB_imageOff").unbind("click");
jQuery("#TB_closeWindowButton").unbind("click");
jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
jQuery("#TB_load").remove();
if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
jQuery("body","html").css({height: "auto", width: "auto"});
jQuery("html").css("overflow","");
}
document.onkeydown = "";
document.onkeyup = "";
return false;
}
function tb_position() {
jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px', height: TB_HEIGHT + 'px'});
jQuery("#TB_closeWindow").css({position:'relative',top:'-'+(TB_HEIGHT+15)+'px',left:TB_WIDTH-15+'px'});
if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
}
}
function tb_parseQuery ( query ) {
var Params = {};
if ( ! query ) {return Params;}// return empty object
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split('=');
if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ' ');
Params[key] = val;
}
return Params;
}
function tb_getPageSize(){
var de = document.documentElement;
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
arrayPageSize = [w,h];
return arrayPageSize;
}
function tb_detectMacXFF() {
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
return true;
}
}
;jQuery.effects || (function($, undefined) {
$.effects = {};
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
function(i, attr) {
$.fx.step[attr] = function(fx) {
if (!fx.colorInit) {
fx.start = getColor(fx.elem, attr);
fx.end = getRGB(fx.end);
fx.colorInit = true;
}
fx.elem.style[attr] = 'rgb(' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
};
});
function getRGB(color) {
var result;
if ( color && color.constructor == Array && color.length == 3 )
return color;
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
return colors['transparent'];
return colors[$.trim(color).toLowerCase()];
}
function getColor(elem, attr) {
var color;
do {
color = $.curCSS(elem, attr);
if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
break;
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
};
var colors = {
aqua:[0,255,255],
azure:[240,255,255],
beige:[245,245,220],
black:[0,0,0],
blue:[0,0,255],
brown:[165,42,42],
cyan:[0,255,255],
darkblue:[0,0,139],
darkcyan:[0,139,139],
darkgrey:[169,169,169],
darkgreen:[0,100,0],
darkkhaki:[189,183,107],
darkmagenta:[139,0,139],
darkolivegreen:[85,107,47],
darkorange:[255,140,0],
darkorchid:[153,50,204],
darkred:[139,0,0],
darksalmon:[233,150,122],
darkviolet:[148,0,211],
fuchsia:[255,0,255],
gold:[255,215,0],
green:[0,128,0],
indigo:[75,0,130],
khaki:[240,230,140],
lightblue:[173,216,230],
lightcyan:[224,255,255],
lightgreen:[144,238,144],
lightgrey:[211,211,211],
lightpink:[255,182,193],
lightyellow:[255,255,224],
lime:[0,255,0],
magenta:[255,0,255],
maroon:[128,0,0],
navy:[0,0,128],
olive:[128,128,0],
orange:[255,165,0],
pink:[255,192,203],
purple:[128,0,128],
violet:[128,0,128],
red:[255,0,0],
silver:[192,192,192],
white:[255,255,255],
yellow:[255,255,0],
transparent: [255,255,255]
};
var classAnimationActions = ['add', 'remove', 'toggle'],
shorthandStyles = {
border: 1,
borderBottom: 1,
borderColor: 1,
borderLeft: 1,
borderRight: 1,
borderTop: 1,
borderWidth: 1,
margin: 1,
padding: 1
};
function getElementStyles() {
var style = document.defaultView
? document.defaultView.getComputedStyle(this, null)
: this.currentStyle,
newStyle = {},
key,
camelCase;
if (style && style.length && style[0] && style[style[0]]) {
var len = style.length;
while (len--) {
key = style[len];
if (typeof style[key] == 'string') {
camelCase = key.replace(/\-(\w)/g, function(all, letter){
return letter.toUpperCase();
});
newStyle[camelCase] = style[key];
}
}
} else {
for (key in style) {
if (typeof style[key] === 'string') {
newStyle[key] = style[key];
}
}
}
return newStyle;
}
function filterStyles(styles) {
var name, value;
for (name in styles) {
value = styles[name];
if (
value == null ||
$.isFunction(value) ||
name in shorthandStyles ||
(/scrollbar/).test(name) ||
(!(/color/i).test(name) && isNaN(parseFloat(value)))
) {
delete styles[name];
}
}
return styles;
}
function styleDifference(oldStyle, newStyle) {
var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
name;
for (name in newStyle) {
if (oldStyle[name] != newStyle[name]) {
diff[name] = newStyle[name];
}
}
return diff;
}
$.effects.animateClass = function(value, duration, easing, callback) {
if ($.isFunction(easing)) {
callback = easing;
easing = null;
}
return this.queue('fx', function() {
var that = $(this),
originalStyleAttr = that.attr('style') || ' ',
originalStyle = filterStyles(getElementStyles.call(this)),
newStyle,
className = that.attr('className');
$.each(classAnimationActions, function(i, action) {
if (value[action]) {
that[action + 'Class'](value[action]);
}
});
newStyle = filterStyles(getElementStyles.call(this));
that.attr('className', className);
that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
$.each(classAnimationActions, function(i, action) {
if (value[action]) { that[action + 'Class'](value[action]); }
});
if (typeof that.attr('style') == 'object') {
that.attr('style').cssText = '';
that.attr('style').cssText = originalStyleAttr;
} else {
that.attr('style', originalStyleAttr);
}
if (callback) { callback.apply(this, arguments); }
});
var queue = $.queue(this),
anim = queue.splice(queue.length - 1, 1)[0];
queue.splice(1, 0, anim);
$.dequeue(this);
});
};
$.fn.extend({
_addClass: $.fn.addClass,
addClass: function(classNames, speed, easing, callback) {
return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
},
_removeClass: $.fn.removeClass,
removeClass: function(classNames,speed,easing,callback) {
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
},
_toggleClass: $.fn.toggleClass,
toggleClass: function(classNames, force, speed, easing, callback) {
if ( typeof force == "boolean" || force === undefined ) {
if ( !speed ) {
return this._toggleClass(classNames, force);
} else {
return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
}
} else {
return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
}
},
switchClass: function(remove,add,speed,easing,callback) {
return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
}
});
$.extend($.effects, {
version: "1.8.12",
save: function(element, set) {
for(var i=0; i < set.length; i++) {
if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
}
},
restore: function(element, set) {
for(var i=0; i < set.length; i++) {
if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
}
},
setMode: function(el, mode) {
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
return mode;
},
getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
var y, x;
switch (origin[0]) {
case 'top': y = 0; break;
case 'middle': y = 0.5; break;
case 'bottom': y = 1; break;
default: y = origin[0] / original.height;
};
switch (origin[1]) {
case 'left': x = 0; break;
case 'center': x = 0.5; break;
case 'right': x = 1; break;
default: x = origin[1] / original.width;
};
return {x: x, y: y};
},
createWrapper: function(element) {
if (element.parent().is('.ui-effects-wrapper')) {
return element.parent();
}
var props = {
width: element.outerWidth(true),
height: element.outerHeight(true),
'float': element.css('float')
},
wrapper = $('<div></div>')
.addClass('ui-effects-wrapper')
.css({
fontSize: '100%',
background: 'transparent',
border: 'none',
margin: 0,
padding: 0
});
element.wrap(wrapper);
wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
if (element.css('position') == 'static') {
wrapper.css({ position: 'relative' });
element.css({ position: 'relative' });
} else {
$.extend(props, {
position: element.css('position'),
zIndex: element.css('z-index')
});
$.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
props[pos] = element.css(pos);
if (isNaN(parseInt(props[pos], 10))) {
props[pos] = 'auto';
}
});
element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' });
}
return wrapper.css(props).show();
},
removeWrapper: function(element) {
if (element.parent().is('.ui-effects-wrapper'))
return element.parent().replaceWith(element);
return element;
},
setTransition: function(element, list, factor, value) {
value = value || {};
$.each(list, function(i, x){
unit = element.cssUnit(x);
if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
});
return value;
}
});
function _normalizeArguments(effect, options, speed, callback) {
if (typeof effect == 'object') {
callback = options;
speed = null;
options = effect;
effect = options.effect;
}
if ($.isFunction(options)) {
callback = options;
speed = null;
options = {};
}
if (typeof options == 'number' || $.fx.speeds[options]) {
callback = speed;
speed = options;
options = {};
}
if ($.isFunction(speed)) {
callback = speed;
speed = null;
}
options = options || {};
speed = speed || options.duration;
speed = $.fx.off ? 0 : typeof speed == 'number'
? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
callback = callback || options.complete;
return [effect, options, speed, callback];
}
function standardSpeed( speed ) {
if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
return true;
}
if ( typeof speed === "string" && !$.effects[ speed ] ) {
return true;
}
return false;
}
$.fn.extend({
effect: function(effect, options, speed, callback) {
var args = _normalizeArguments.apply(this, arguments),
args2 = {
options: args[1],
duration: args[2],
callback: args[3]
},
mode = args2.options.mode,
effectMethod = $.effects[effect];
if ( $.fx.off || !effectMethod ) {
if ( mode ) {
return this[ mode ]( args2.duration, args2.callback );
} else {
return this.each(function() {
if ( args2.callback ) {
args2.callback.call( this );
}
});
}
}
return effectMethod.call(this, args2);
},
_show: $.fn.show,
show: function(speed) {
if ( standardSpeed( speed ) ) {
return this._show.apply(this, arguments);
} else {
var args = _normalizeArguments.apply(this, arguments);
args[1].mode = 'show';
return this.effect.apply(this, args);
}
},
_hide: $.fn.hide,
hide: function(speed) {
if ( standardSpeed( speed ) ) {
return this._hide.apply(this, arguments);
} else {
var args = _normalizeArguments.apply(this, arguments);
args[1].mode = 'hide';
return this.effect.apply(this, args);
}
},
__toggle: $.fn.toggle,
toggle: function(speed) {
if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
return this.__toggle.apply(this, arguments);
} else {
var args = _normalizeArguments.apply(this, arguments);
args[1].mode = 'toggle';
return this.effect.apply(this, args);
}
},
cssUnit: function(key) {
var style = this.css(key), val = [];
$.each( ['em','px','%','pt'], function(i, unit){
if(style.indexOf(unit) > 0)
val = [parseFloat(style), unit];
});
return val;
}
});
$.easing.jswing = $.easing.swing;
$.extend($.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
return $.easing[$.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
})(jQuery);
﻿/*!
* jQuery blockUI plugin
* Version 2.31 (06-JAN-2010)
* @requires jQuery v1.2.3 or later
*
* Examples at: http://malsup.com/jquery/block/
* Copyright (c) 2007-2008 M. Alsup
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/
;(function($) {
if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);
return;
}
$.fn._fadeIn = $.fn.fadeIn;
var noOp = function() {};
var mode = document.documentMode || 0;
var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
$.blockUI   = function(opts) { install(window, opts); };
$.unblockUI = function(opts) { remove(window, opts); };
$.growlUI = function(title, message, timeout, onClose) {
var $m = $('<div class="growlUI"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 3000;
$.blockUI({
message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
timeout: timeout, showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.growlCSS
});
};
$.fn.block = function(opts) {
return this.unblock({ fadeOut: 0 }).each(function() {
if ($.css(this,'position') == 'static')
this.style.position = 'relative';
if ($.browser.msie)
this.style.zoom = 1; // force 'hasLayout'
install(this, opts);
});
};
$.fn.unblock = function(opts) {
return this.each(function() {
remove(this, opts);
});
};
$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost!
$.blockUI.defaults = {
message:  '<h1>Please wait...</h1>',
title: null,	  // title string; only used when theme == true
draggable: true,  // only used when theme == true (requires jquery-ui.js to be loaded)
theme: false, // set to true to use with jQuery UI themes
css: {
padding:	0,
margin:		0,
width:		'30%',
top:		'40%',
left:		'35%',
textAlign:	'center',
color:		'#000',
border:		'3px solid #aaa',
backgroundColor:'#fff',
cursor:		'wait'
},
themedCSS: {
width:	'30%',
top:	'40%',
left:	'35%'
},
overlayCSS:  {
backgroundColor: '#000',
opacity:	  	 0.6,
cursor:		  	 'wait'
},
growlCSS: {
width:  	'350px',
top:		'10px',
left:   	'',
right:  	'10px',
border: 	'none',
padding:	'5px',
opacity:	0.6,
cursor: 	'default',
color:		'#fff',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius':	 '10px'
},
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
forceIframe: false,
baseZ: 1000,
centerX: true, // <-- only effects element blocking (page block controlled via css above)
centerY: true,
allowBodyStretch: true,
bindEvents: true,
constrainTabKey: true,
fadeIn:  200,
fadeOut:  400,
timeout: 0,
showOverlay: true,
focusInput: true,
applyPlatformOpacityRules: true,
onBlock: null,
onUnblock: null,
quirksmodeOffsetHack: 4
};
var pageBlock = null;
var pageBlockEls = [];
function install(el, opts) {
var full = (el == window);
var msg = opts && opts.message !== undefined ? opts.message : undefined;
opts = $.extend({}, $.blockUI.defaults, opts || {});
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
msg = msg === undefined ? opts.message : msg;
if (full && pageBlock)
remove(window, {fadeOut:0});
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
var node = msg.jquery ? msg[0] : msg;
var data = {};
$(el).data('blockUI.history', data);
data.el = node;
data.parent = node.parentNode;
data.display = node.style.display;
data.position = node.style.position;
if (data.parent)
data.parent.removeChild(node);
}
var z = opts.baseZ;
var lyr1 = ($.browser.msie || opts.forceIframe)
? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
: $('<div class="blockUI" style="display:none"></div>');
var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
var lyr3;
if (opts.theme && full) {
var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +
'<div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
'<div class="ui-widget-content ui-dialog-content"></div>' +
'</div>';
lyr3 = $(s);
}
else {
lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')
: $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');
}
if (msg) {
if (opts.theme) {
lyr3.css(themedCSS);
lyr3.addClass('ui-widget-content');
}
else
lyr3.css(css);
}
if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
lyr2.css(opts.overlayCSS);
lyr2.css('position', full ? 'fixed' : 'absolute');
if ($.browser.msie || opts.forceIframe)
lyr1.css('opacity',0.0);
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
$.each(layers, function() {
this.appendTo($par);
});
if (opts.theme && opts.draggable && $.fn.draggable) {
lyr3.draggable({
handle: '.ui-dialog-titlebar',
cancel: 'li'
});
}
var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
if (ie6 || expr) {
if (full && opts.allowBodyStretch && $.boxModel)
$('html,body').css('height','100%');
if ((ie6 || !$.boxModel) && !full) {
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
var fixT = t ? '(0 - '+t+')' : 0;
var fixL = l ? '(0 - '+l+')' : 0;
}
$.each([lyr1,lyr2,lyr3], function(i,o) {
var s = o[0].style;
s.position = 'absolute';
if (i < 2) {
full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
: s.setExpression('height','this.parentNode.offsetHeight + "px"');
full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
: s.setExpression('width','this.parentNode.offsetWidth + "px"');
if (fixL) s.setExpression('left', fixL);
if (fixT) s.setExpression('top', fixT);
}
else if (opts.centerY) {
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
s.marginTop = 0;
}
else if (!opts.centerY && full) {
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
s.setExpression('top',expression);
}
});
}
if (msg) {
if (opts.theme)
lyr3.find('.ui-widget-content').append(msg);
else
lyr3.append(msg);
if (msg.jquery || msg.nodeType)
$(msg).show();
}
if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
lyr1.show(); // opacity is zero
if (opts.fadeIn) {
var cb = opts.onBlock ? opts.onBlock : noOp;
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
var cb2 = msg ? cb : noOp;
if (opts.showOverlay)
lyr2._fadeIn(opts.fadeIn, cb1);
if (msg)
lyr3._fadeIn(opts.fadeIn, cb2);
}
else {
if (opts.showOverlay)
lyr2.show();
if (msg)
lyr3.show();
if (opts.onBlock)
opts.onBlock();
}
bind(1, el, opts);
if (full) {
pageBlock = lyr3[0];
pageBlockEls = $(':input:enabled:visible',pageBlock);
if (opts.focusInput)
setTimeout(focus, 20);
}
else
center(lyr3[0], opts.centerX, opts.centerY);
if (opts.timeout) {
var to = setTimeout(function() {
full ? $.unblockUI(opts) : $(el).unblock(opts);
}, opts.timeout);
$(el).data('blockUI.timeout', to);
}
};
function remove(el, opts) {
var full = (el == window);
var $el = $(el);
var data = $el.data('blockUI.history');
var to = $el.data('blockUI.timeout');
if (to) {
clearTimeout(to);
$el.removeData('blockUI.timeout');
}
opts = $.extend({}, $.blockUI.defaults, opts || {});
bind(0, el, opts); // unbind events
var els;
if (full) // crazy selector to handle odd field errors in ie6/7
els = $('body').children().filter('.blockUI').add('body > .blockUI');
else
els = $('.blockUI', el);
if (full)
pageBlock = pageBlockEls = null;
if (opts.fadeOut) {
els.fadeOut(opts.fadeOut);
setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
}
else
reset(els, data, opts, el);
};
function reset(els,data,opts,el) {
els.each(function(i,o) {
if (this.parentNode)
this.parentNode.removeChild(this);
});
if (data && data.el) {
data.el.style.display = data.display;
data.el.style.position = data.position;
if (data.parent)
data.parent.appendChild(data.el);
$(el).removeData('blockUI.history');
}
if (typeof opts.onUnblock == 'function')
opts.onUnblock(el,opts);
};
function bind(b, el, opts) {
var full = el == window, $el = $(el);
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
return;
if (!full)
$el.data('blockUI.isBlocked', b);
if (!opts.bindEvents || (b && !opts.showOverlay))
return;
var events = 'mousedown mouseup keydown keypress';
b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
};
function handler(e) {
if (e.keyCode && e.keyCode == 9) {
if (pageBlock && e.data.constrainTabKey) {
var els = pageBlockEls;
var fwd = !e.shiftKey && e.target == els[els.length-1];
var back = e.shiftKey && e.target == els[0];
if (fwd || back) {
setTimeout(function(){focus(back)},10);
return false;
}
}
}
if ($(e.target).parents('div.blockMsg').length > 0)
return true;
return $(e.target).parents().children().filter('div.blockUI').length == 0;
};
function focus(back) {
if (!pageBlockEls)
return;
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
if (e)
e.focus();
};
function center(el, x, y) {
var p = el.parentNode, s = el.style;
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
if (x) s.left = l > 0 ? (l+'px') : '0';
if (y) s.top  = t > 0 ? (t+'px') : '0';
};
function sz(el, p) {
return parseInt($.css(el,p))||0;
};
})(jQuery);
var url = document.location.href.split('#')[0].split('/');
var sectionName = url[3];
var photoNumber = url.pop();
var titleTrack = url.pop();
jQuery(".paginazione-gallery-zoom-2011 a").click(function(){(new Image(1,1)).src = '//secure-it.imrworldwide.com/cgi-bin/m?rnd=' + (new Date()).getTime() +'&ci=mondadori-it&cg=0&si=http%3A//www.donnamoderna.com/zoom_immagine';});
jQuery(document).ready(function(){setTimeout("jQuery('div.jcarousel-prev').click(function(){_gaq.push(['_trackEvent','Engagement','Slide_prev', 'slider_'+sectionName]);});",1000);});
jQuery(document).ready(function(){setTimeout("jQuery('div.jcarousel-next').click(function(){_gaq.push(['_trackEvent','Engagement','Slide_next', 'slider_'+sectionName]);});",1000);});
var tag_array = js_variables['tag_array'];
if (tag_array != undefined && tag_array != null) {
for (var index in tag_array) {
_gaq.push(['b._trackEvent', 'Semantic', 'Tag', tag_array[index]]);
}
jQuery("p.tags-gallery-elenco-2011.colore-canale-2011.column a.colore-canale-2011").click(function () {
var tag = jQuery(this).attr("title");
_gaq.push(['b._trackEvent', 'Semantic', 'ClickTag', tag]);
});
}
function bindEventoTipaFriend() {
jQuery(".dm2011_tipafriend").click(function(){
var nodeid=jQuery(".dm2011_tipafriend_nodeid",jQuery(this).parent()).html();
nodeurl=jQuery(".tpf-url",jQuery(this).parent()).html();
jQuery.ajax(
{
type: "POST",
url: "/tipafriend/get",
data: "tip_node_id="+nodeid+"&tip_node_url="+nodeurl,
success:function(t){
jQuery(".dm2011_tipafriend").unbind();
jQuery('.tpf-'+nodeid).first().empty();
jQuery('.tpf-'+nodeid).first().append(t);
tb_init("#open-tip-form_"+nodeid+",#ok-response_"+nodeid);
jQuery("#open-tip-form_"+nodeid).click();
}
});
});
}
jQuery(document).ready(function(){
var apriFlowPlayer = js_variables['apriFlowPlayer'];
if(apriFlowPlayer) {
var video_title = js_variables['video_title']; video_title.replace("'", "`");
var videoplayer_src = js_variables['videoplayer_src'];
var duration_sec = js_variables['duration_sec'];
var bitrates_url = js_variables['bitrates_url'];
var has_video_hd = js_variables['has_video_hd'];
var bitrates_url_hd = js_variables['bitrates_url_hd'];
var bwcheck_url = js_variables['bwcheck_url'];
var bwcheck_netConnectionUrl = js_variables['bwcheck_netConnectionUrl'];
var pseudostreaming_url = js_variables['pseudostreaming_url'];
var apriAdStream = js_variables['apriAdStream'];
var openAdStream_url = js_variables['openAdStream_url'];
var CODICE_bitrates_hd = '';
if(has_video_hd) {
CODICE_bitrates_hd = ', {url: "' + bitrates_url_hd + '", bitrate: 1200}';
}
var CODICE_apriAdStream = '';
if(apriAdStream) {
CODICE_apriAdStream = ', openAdStream: {url: "' + openAdStream_url + '"'
+ ', "autoPlay": true'
+ ', "overlays": {"regions": [{"id": "my-ad-notice"'
+ '                          , "verticalAlign": "top"'
+ '                          , "horizontalAlign": "left"'
+ '                          , "backgroundColor": "transparent"'
+ '                          , "width": "35pct"'
+ '                          , "style": ".smalltext {font-family: Georgia, Times, serif; font-size:10px; }"}]}'
+ ', "ads": {"servers": [{"type": "OpenX"'
+ '        , "apiAddress": "http://ad77.neodatagroup.com/ad/mediamond_fplayer.jsp"}]'
+ ', "schedule": [{"zone": "fmt_vast_dm"'
+ '              , "position": "pre-roll"'
+ '              , "notice": {"show": true'
+ '                         , "region": "my-ad-notice"'
+ '                         , "message": "Messaggio Promozionale di _seconds_ secondi"}}'
+ '             , {"zone": "ame_dn_sfila_inter"' // zona da modificare in base alla sezione
+ '              , "position": "pre-roll"'
+ '              , "notice": {"show": true'
+ '                         , "region": "my-ad-notice"'
+ '                         , "message": "Messaggio Promozionale di _seconds_ secondi"}}'
+ '             , {"zone": "vp_1"'
+ '             ,  "position": "pre-roll"'
+ '             ,  "notice": {"show": true'
+ '                         , "region": "my-ad-notice"'
+ '                         , "message": "Messaggio Promozionale di _seconds_ secondi"}}]}}';
}
var CODICE_flowplayer = 'flowplayer("videoplayer"'
+ ', {src: "' + videoplayer_src + '", cachebusting: true,  wmode: "opaque"}'
+ ', {key: \'#@d4b87a6528d20d21865\'' // product key from your account
+ ' , clip: {onStart:function (){_gaq.push([\'_trackEvent\',\'Engagement\',\'Video_play\', \'' + video_title + '\']);ntptAddPair(\'action\', \'Multimedia\'); ntptAddPair(\'label\', \'play_video\'); ntptAddPair(\'valore\', \'' + video_title + '\'); ntptEventTag(\'ev=sito\');}}'
+ ' , playlist: [{url: \'\''
+ '             , urlResolvers: \'bwcheck\''
+ '             , autoPlay: true'
+ '             , baseUrl: \'\''
+ '             , provider: \'pseudostreaming\''
+ '             , duration: ' + duration_sec
+ '             , scaling: \'fit\''
+ '             , bitrates: [{url: ' + bitrates_url + ', bitrate: 400}'
+ CODICE_bitrates_hd + ']}]'
+ ' , play: { replayLabel: \'Riproduci il video\' }'
+ ' , plugins: {bwcheck: {url: "' + bwcheck_url + '"'
+ '                     , netConnectionUrl: "' + bwcheck_netConnectionUrl + '"}' // bandwidth check plugin
+ ' , pseudostreaming: {url: "' + pseudostreaming_url + '"}'
+ CODICE_apriAdStream + '}});';
eval(CODICE_flowplayer);
}
jQuery(".dm2011_header-commenti-trigger").css("cursor","pointer");
jQuery(".dm2011_header-commenti-trigger").click(function(){
window.location.href=jQuery(".dm2011_commenti_counter_br",jQuery(this).parent()).html()+"#dm2011_dilatua";
});
jQuery(".dm2011_stampa").click(function(){
javascript:window.print();
return false;
});
if (jQuery(".hp-vetrina-2011-call-top h2").length>0) {
var callTop = jQuery(".hp-vetrina-2011-call-top h2").outerWidth(true);
jQuery(".call-fumetto-top").css("width", callTop);
}
if (jQuery(".hp-vetrina-2011-call-bottom h3").length>0) {
var callBottom = jQuery(".hp-vetrina-2011-call-bottom h3").outerWidth(true);
if (callBottom.length>0) jQuery(".call-fumetto-bottom").css("width", callBottom);
}
bindEventoTipaFriend();
jQuery(".ntptLinkTagClick").click(function() {
ntptLinkTag(this,'lk=1');
});
jQuery(".hp-vetrina-2011").each(function () {
jQuery("#hp-vetrina-sx-" + indiceContenuto[0]).show();
jQuery("#hp-vetrina-dx-1_" + indiceContenuto[1]).show();
jQuery("#hp-vetrina-dx-2_" + indiceContenuto[2]).show();
jQuery("#hp-vetrina-dx-3_" + indiceContenuto[3]).show();
if (jQuery('#hp-vetrina-2011-call-top-' + indiceContenuto[0] + ' h2').length>0) {
var callTop = jQuery('#hp-vetrina-2011-call-top-' + indiceContenuto[0] + ' h2').outerWidth(true);
jQuery('#hp-vetrina-2011-call-top-' + indiceContenuto[0] + ' .call-fumetto-top').css('width', callTop);
}
if (jQuery('#hp-vetrina-2011-call-bottom-' + indiceContenuto[0] + ' h3').length>0) {
if (jQuery('#hp-vetrina-2011-call-bottom-' + indiceContenuto[0] + ' h3').outerHeight(true)>40)	{
jQuery('.hp-vetrina-2011').css('height', '345px');
}
}
});
jQuery(".dm2011_preferiti_forum").each(function () {
jQuery.ajax({url: linkCommunity+"/scripts/jsonp/get_json_file.php",
data : {"nomefile":"forum_activities/forum_activities.json"},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
for(i=0;i<data.length;i++) {
dati=unserialize(data[i].data);
titolothread=riduciCaratteri(dati["thread_name"],35);
nomeutente=riduciCaratteri(data[i].name_thread,15);
jQuery("#dm2011_title_daiforum_"+i).html(titolothread);
jQuery("#dm2011_canale_daiforum_"+i).html(data[i].title_forum);
jQuery("#dm2011_title_daiforum_"+i).attr("href",dati["post_link"]);
jQuery("#dm2011_title_daiforum_"+i).attr("title",titolothread);
jQuery("#dm2011_nickname_daiforum_"+i).html(nomeutente);
pathAvatar=calcolaPathAvatar(data[i].name_thread,"50x50");
jQuery("#dm2011_image_daiforum_"+i).attr("src", pathAvatar.toLowerCase());
jQuery("#dm2011_image_daiforum_"+i).parent().attr("title", nomeutente);
jQuery("#dm2011_image_daiforum_"+i).parent().attr("href",dati["post_link"]);
}
}}
});
});
jQuery(".cucina-hp-forum").each(function () {
var channelCommunity=jQuery(".dm2011_channel_community").html();
var nomefile="";
if (channelCommunity!=undefined && channelCommunity!="") {
nomefile="forum_activities/forum_activities_"+str_replace(" ","_",channelCommunity)+".json";
} else {
nomefile="forum_activities/forum_activities_Cucina.json";
}
jQuery.ajax({url: linkCommunity+"/scripts/jsonp/get_json_file.php",
data : {"nomefile": nomefile},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
for(i=0;i<data.length;i++) {
dati=unserialize(data[i].data);
nomeutente=riduciCaratteri(data[i].name_thread,15);
titolothread=riduciCaratteri(dati["thread_name"],30);
canale=riduciCaratteri(data[i].title_forum,35);
jQuery("#dm2011_title_daiforum_"+i).html(titolothread);
jQuery("#dm2011_canale_daiforum_"+i).html(canale);
jQuery("#dm2011_title_daiforum_"+i).attr("href",dati["post_link"]);
jQuery("#dm2011_title_daiforum_"+i).attr("title",titolothread);
jQuery("#dm2011_nickname_daiforum_"+i).html(nomeutente);
pathAvatar=calcolaPathAvatar(data[i].name_thread,"50x50");
jQuery("#dm2011_image_daiforum_"+i).attr("src", pathAvatar.toLowerCase());
jQuery("#dm2011_image_daiforum_"+i).parent().attr("title", nomeutente);
jQuery("#dm2011_image_daiforum_"+i).parent().attr("href",dati["post_link"]);
}
}}
});
});
jQuery(".dm2011_preferiti_blog").each(function () {
jQuery.ajax({url: linkCommunity+"/scripts/jsonp/get_json_file.php",
data : {"nomefile":"blog_activities.json"},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
for(i=0;i<data.length;i++) {
titolothread=riduciCaratteri(data[i].title,35);
nomeutente=riduciCaratteri(data[i].name,15);
jQuery("#dm2011_title_daiblog_"+i).html(titolothread);
jQuery("#dm2011_nickname_daiblog_"+i).html(nomeutente);
jQuery("#dm2011_title_daiblog_"+i).attr("href",linkCommunity+"/"+data[i].url);
jQuery("#dm2011_title_daiblog_"+i).attr("title",titolothread);
pathAvatar=calcolaPathAvatar(data[i].name,"50x50");
jQuery("#dm2011_image_daiblog_"+i).attr("src", pathAvatar.toLowerCase());
jQuery("#dm2011_image_daiblog_"+i).parent().attr("title", nomeutente);
jQuery("#dm2011_image_daiblog_"+i).parent().attr("href", linkCommunity+"/"+data[i].url);
}
}}
});
});
jQuery(".dm_2011-daglialbum").each(function () {
jQuery.ajax({url: linkCommunity+"/scripts/jsonp/get_json_file_4album.php",
data : {
"tag" : jQuery(".dm_2011_tag_album",jQuery(this)).html()
},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
for(i=0;i<data.length;i++) {
jQuery("#dm2011_image_daglialbum_"+i).attr("src",data[i].image);
jQuery("#dm2011_image_daglialbum_"+i).parent().attr("title", data[i].title);
jQuery("#dm2011_image_daglialbum_"+i).parent().attr("href", data[i].url);
}
}}
});
});
jQuery(".dm2011_counter").each(function () {
url=jQuery(this).html().split("$$$");
id=jQuery(this).attr("id").split("-");
jQuery.ajax({url: linkCommunity+"/scripts/jsonp/set_counter.php",
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
data : {"type":id[2]
,"key":id[1]
,"nodeid":id[3]
,"url":url[0]
,"title":url[1]
}
});
});
var thid=new Array();
});
function riduciCaratteri(stringa,lunghezza) {
if (stringa==undefined) {
return "";
}
if (stringa.length>lunghezza) {
stringa=stringa.substr(0,lunghezza)+"...";
}
return stringa;
}
jQuery(document).ready(function()
{
var index = 0;
var images = jQuery("#gallery-2011 li");
var thumbs = jQuery("#thumbs-2011 div");
var numeroRicette = jQuery("#thumbs-2011").children().size();
var id_process = 0;
if (jQuery("#gallery-2011 li").length>0) {
var imgHeight = 45;
for (i = 0; i < thumbs.length; i++) {
jQuery(thumbs[i]).addClass("thumb-" + i);
jQuery(images[i]).addClass("image-" + i);
}
jQuery("#prev-2011").click(sift_pre);
jQuery("#next-2011").click(sift_next);
show(index);
id_process = setInterval(sift, timing_anim);
thumbs.click(ancora);
}
function ancora() {
var numthumb = jQuery(this).index();
if (numthumb>(i-1)) {
clickthumb = (numthumb-(i));
show(clickthumb);
} else {
show(numthumb);
}
}
function sift_pre() {
if(index>=1) {
index-=1;
} else {
index = (thumbs.length-1)
}
show (index);
clearInterval(id_process);
id_process=setInterval(sift, timing_anim);
}
function sift() {
if(index<(thumbs.length-1)) {
index+=1;
} else {
index=0;
}
show(index);
}
function sift_next() {
if(index<(thumbs.length-1)) {
index+=1;
} else {
index=0;
}
show(index);
clearInterval(id_process);
id_process=setInterval(sift, timing_anim);
}
function show(num)
{
jQuery(images).fadeOut(400);
jQuery(".image-"+num).stop().fadeIn(400);
var scrollPos = ((num)*(imgHeight+20));
if(num<numeroRicette-2) {
jQuery("#thumbs-2011").stop().animate({scrollTop: scrollPos}, 400);
}
_gaq.push(['_trackPageview', '/cucina_slider']);
_gaq.push(['_trackEvent','Engagement','Slide_next','cucina_slider']);
(new Image(1,1)).src = '//secure-it.imrworldwide.com/cgi-bin/m?rnd=' + (new Date()).getTime() +'&ci=mondadori-it&cg=0&si=http%3A//www.donnamoderna.com/cucina_slider';
var txtfototop = jQuery(".image-"+num).children("p.call-cucina-top").text();
var linkfototop = jQuery(".image-"+num).children("p.call-cucina-top-link").text();
var txtfotobottom = jQuery(".image-"+num).children("p.call-cucina-bottom").text();
var linkfotobottom = jQuery(".image-"+num).children("p.call-cucina-bottom-link").text();
var wrapCalltop = jQuery(".slider-cucina-2011-call-top");
var wrapCallbottom = jQuery(".slider-cucina-2011-call-bottom");
if (txtfototop!='') {
wrapCalltop.fadeIn(400);
}
else {
wrapCalltop.hide();
}
if (txtfotobottom!='') {
wrapCallbottom.fadeIn(400);
}
else {
wrapCallbottom.hide();
}
jQuery('.cucina-calltop a').html(txtfototop);
jQuery('.cucina-calltop a').attr('title',txtfototop);
jQuery('.cucina-calltop a').attr('href',linkfototop);
jQuery('.cucina-callbottom a').html(txtfotobottom);
jQuery('.cucina-callbottom a').attr('title',txtfotobottom);
jQuery('.cucina-callbottom a').attr('href',linkfotobottom);
var callTopslider = jQuery(".cucina-calltop").outerWidth(true);
jQuery(".call-fumetto-cucina-top").css("width", callTopslider);
}
});
jQuery(document).ready(function() {
jQuery(".categorie-cucina-2011 li").mouseover(function () {
jQuery(".categorie-cucina-2011 li").css('background-color','#FFFFFF');
jQuery(this).css('background-color','#fad9aa');
});
jQuery(".categorie-cucina-2011 li").mouseout(function () {
jQuery(this).css('background-color','#FFFFFF');
});
});
function mycarousel_initCallback(carousel)
{
carousel.buttonNext.bind('click', function() {
carousel.startAuto(0);
});
carousel.buttonPrev.bind('click', function() {
carousel.startAuto(0);
});
carousel.clip.hover(function() {
carousel.stopAuto();
}, function() {
carousel.startAuto();
});
};
var theModelCarousel = null;
function hpCucinaInEvidenzaCarousel_initCallback(carousel)
{
theModelCarousel = carousel;
jQuery(".DM-tab-a h5").click(function(){
carousel.stopAuto();
jQuery("#ajax-loader-slider-cucina-hp").css('display','block');
jQuery("#cucina-hp-carousel").css('display','none');
});
jQuery(".DM-tab-b h5").click(function(){
carousel.stopAuto();
jQuery("#ajax-loader-slider-cucina-hp").css('display','block');
jQuery("#cucina-hp-carousel").css('display','none');
});
jQuery(".DM-tab-c h5").click(function(){
carousel.stopAuto();
jQuery("#ajax-loader-slider-cucina-hp").css('display','block');
jQuery("#cucina-hp-carousel").css('display','none');
});
jQuery(".DM-tab-d h5").click(function(){
carousel.stopAuto();
jQuery("#ajax-loader-slider-cucina-hp").css('display','block');
jQuery("#cucina-hp-carousel").css('display','none');
});
};
jQuery(document).ready(function() {
jQuery(".DM-tab-a h5").click(function () {
jQuery(".DM-tab-a h5").addClass('colore-canale-2011');
jQuery(".DM-tab-b h5,.DM-tab-c h5,.DM-tab-d h5").removeClass('colore-canale-2011');
jQuery(".DM-tab-a h5,").css('cursor','default');
jQuery(".DM-tab-b h5,.DM-tab-c h5,.DM-tab-d h5").css('cursor','pointer');
jQuery(".DM-tab-a").css('background-position','-10px -560px');
jQuery(".DM-tab-b,.DM-tab-c,.DM-tab-d").css('background-position','-170px -560px');
var elementsToLoad = jQuery("#cucina-hp-slider-element-tabA").val();
jQuery.ez( "cucina::loadSliderItems::"+elementsToLoad, {postData: ''} , _callBackSliderCucinaHp );
});
jQuery(".DM-tab-b h5").click(function () {
jQuery(".DM-tab-b h5").addClass('colore-canale-2011');
jQuery(".DM-tab-a h5,.DM-tab-c h5,.DM-tab-d h5").removeClass('colore-canale-2011');
jQuery(".DM-tab-b h5,").css('cursor','default');
jQuery(".DM-tab-a h5,.DM-tab-c h5,.DM-tab-d h5").css('cursor','pointer');
jQuery(".DM-tab-b").css('background-position','-10px -560px');
jQuery(".DM-tab-a").css('background-position','-173px -560px');
jQuery(".DM-tab-c,.DM-tab-d").css('background-position','-170px -560px');
var elementsToLoad = jQuery("#cucina-hp-slider-element-tabB").val();
jQuery.ez( "cucina::loadSliderItems::"+elementsToLoad, {postData: ''} , _callBackSliderCucinaHp );
});
jQuery(".DM-tab-c h5").click(function () {
jQuery(".DM-tab-c h5").addClass('colore-canale-2011');
jQuery(".DM-tab-a h5,.DM-tab-b h5,.DM-tab-d h5").removeClass('colore-canale-2011');
jQuery(".DM-tab-c h5,").css('cursor','default');
jQuery(".DM-tab-a h5,.DM-tab-b h5,.DM-tab-d h5").css('cursor','pointer');
jQuery(".DM-tab-c").css('background-position','-10px -560px');
jQuery(".DM-tab-d").css('background-position','-170px -560px');
jQuery(".DM-tab-a,.DM-tab-b").css('background-position','-173px -560px');
var elementsToLoad = jQuery("#cucina-hp-slider-element-tabC").val();
jQuery.ez( "cucina::loadSliderItems::"+elementsToLoad, {postData: ''} , _callBackSliderCucinaHp );
});
jQuery(".DM-tab-d h5").click(function () {
jQuery(".DM-tab-d h5").addClass('colore-canale-2011');
jQuery(".DM-tab-a h5,.DM-tab-b h5,.DM-tab-c h5").removeClass('colore-canale-2011');
jQuery(".DM-tab-d h5,").css('cursor','default');
jQuery(".DM-tab-a h5,.DM-tab-b h5,.DM-tab-c h5").css('cursor','pointer');
jQuery(".DM-tab-d").css('background-position','-10px -560px');
jQuery(".DM-tab-c").css('background-position','-173px -560px');
jQuery(".DM-tab-a,.DM-tab-b").css('background-position','-173px -560px');
var elementsToLoad = jQuery("#cucina-hp-slider-element-tabD").val();
jQuery.ez( "cucina::loadSliderItems::"+elementsToLoad, {postData: ''} , _callBackSliderCucinaHp );
});
});
function _callBackSliderCucinaHp( data )
{
jQuery("#ajax-loader-slider-cucina-hp").css('display','none');
jQuery("#cucina-hp-carousel").css('display','block');
theModelCarousel.reset();
for( var i=1 ; i<=data.content.nElements ; i++ )
{
theModelCarousel.add(i,data.content[(i-1)]);
}
theModelCarousel.size(data.content.nElements);
theModelCarousel.scroll(theModelCarousel.first);
theModelCarousel.reload();
theModelCarousel.startAuto(0);
}
jQuery(document).ready(function()
{
var index = js_variables["offset_img_ricetta"];
var imagesoriz = jQuery("#gallery-2011-oriz li");
var thumbsoriz = jQuery("#thumbs-2011-oriz img");
var imgWidth = jQuery(thumbsoriz).attr("width");
for (i=0; i<thumbsoriz.length; i++)
{
jQuery(thumbsoriz[i]).addClass("thumb-"+i);
}
if (thumbsoriz.length > 7) {
jQuery("#prev-2011-oriz").click(siftpre);
jQuery("#next-2011-oriz").click(sift);
}
else {
jQuery("#prev-2011-oriz").css("display", "none");
jQuery("#next-2011-oriz").css("display", "none");
}
show_carosel(index);
function siftpre()
{
if (index>=7){index-=7 ; }
else {index=(thumbsoriz.length-1)}
show_carosel (index);
}
function sift()
{
if (index<(thumbsoriz.length-1)){index+=7 ; }
else {index=0}
show_carosel (index);
}
function show_carosel(num)
{
var firstImg = parseInt(num/7) * 7;
var scrollPos = ((firstImg)*(imgWidth+18));
jQuery("#thumbs-2011-oriz").stop().animate({'margin-left': -scrollPos}, 400);
}
function show_img(num)
{
jQuery(imagesoriz).fadeOut(400);
jQuery(".image-"+num).stop().fadeIn(400);
}
});
jQuery(document).ready(function() {
jQuery(".ricetta-2011-info").mouseover(function () {
jQuery(this).addClass("arancio-2011");
jQuery(this).removeClass("grigiochiaro-2011");
});
jQuery(".ricetta-2011-info").mouseout(function () {
jQuery(this).removeClass("arancio-2011");
jQuery(this).addClass("grigiochiaro-2011");
});
});
jQuery(document).ready(function() {
jQuery("#dettaglio-video-player-wrapper").each(function () {
var video_title = js_variables['video_title'];
var swf_url = js_variables['swf_url'];
var swf_net_connection_url = js_variables['swf_net_connection_url'];
var swf_pseudostreaming_url = js_variables['swf_pseudostreaming_url'];
var swf_ad_streamer_url = js_variables['swf_ad_streamer_url'];
var video_duration = js_variables['video_duration'];
var video_duration_sec = js_variables['duration_sec'];
var video_url = js_variables['video_url'];
var video_url_hd = js_variables['video_url_hd'];
var pre_roll = js_variables['pre_roll'];
var splash_image = js_variables['splash_image'];
var autoplay = true;
if( video_title && video_title.length>0 ) {
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
}
if( video_url && video_url.length>0 ) {
video_url = video_url.replace('"', "");
video_url = video_url.replace('"', "");
video_url = video_url.replace('"', "");
}
if( video_url_hd && video_url_hd.length>0 ) {
video_url_hd = video_url_hd.replace('"', "");
video_url_hd = video_url_hd.replace('"', "");
video_url_hd = video_url_hd.replace('"', "");
}
if( video_url && video_url.length>0 ) {
if( pre_roll == 1 )
{
if( video_url_hd.length > 0 ) FlowPlayerWithHDWithAds( "dettaglio-video-player-wrapper" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , video_duration_sec , video_url , video_url_hd , swf_ad_streamer_url )
else FlowPlayerNoHDWithAds( "dettaglio-video-player-wrapper" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , video_duration_sec , video_url , swf_ad_streamer_url )
}
else
{
if( video_url_hd.length > 0 ) FlowPlayerWithHDNoAds( "dettaglio-video-player-wrapper" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , video_duration_sec , video_url , video_url_hd )
else FlowPlayerNoHDNoAds( "dettaglio-video-player-wrapper" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , video_duration_sec , video_url )
}
}
});
});
function FlowPlayerNoHDNoAds( div_id , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , video_duration , video_url )
{
flowplayer(div_id,{src: swf_net_connection_url, cachebusting: true,  wmode: "opaque"}, {
key: '#@d4b87a6528d20d21865' ,
clip:{ onStart:function (){_gaq.push(['_trackEvent','Engagement','Video_play',video_title]);ntptAddPair('action', 'Multimedia'); ntptAddPair('label', 'play_video'); ntptAddPair('valore', video_title); ntptEventTag('ev=sito');}},
playlist: [{url: splash_image, scaling: 'orig'},
{
url: '',
urlResolvers: 'bwcheck',
autoPlay: autoplay,
provider: 'pseudostreaming',
duration: video_duration,
scaling: 'fit',
bitrates: [
{url: video_url,bitrate: 400}
]
}],
play: { replayLabel: 'Riproduci il video' },
plugins: {
bwcheck: {
url: swf_url,
netConnectionUrl: swf_net_connection_url
},
pseudostreaming: {
url: swf_pseudostreaming_url
}
}
});
}
function FlowPlayerWithHDNoAds( div_id , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , video_duration , video_url , video_url_hd )
{
flowplayer(div_id,{src: swf_net_connection_url, cachebusting: true,  wmode: "opaque"}, {
key: '#@d4b87a6528d20d21865' ,
clip:{ onStart:function (){_gaq.push(['_trackEvent','Engagement','Video_play',video_title]);ntptAddPair('action', 'Multimedia'); ntptAddPair('label', 'play_video'); ntptAddPair('valore', video_title); ntptEventTag('ev=sito');}},
playlist: [{url: splash_image, scaling: 'orig'},
{
url: '',
urlResolvers: 'bwcheck',
autoPlay: autoplay,
provider: 'pseudostreaming',
duration: video_duration,
scaling: 'fit',
bitrates: [
{url: video_url,bitrate: 400},
{url: video_url_hd,bitrate: 1200}
]
}],
play: { replayLabel: 'Riproduci il video' },
plugins: {
bwcheck: {
url: swf_url,
netConnectionUrl: swf_net_connection_url
},
pseudostreaming: {
url: swf_pseudostreaming_url
}
}
});
}
function FlowPlayerNoHDWithAds( div_id , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , video_duration , video_url , swf_ad_streamer_url )
{
flowplayer(div_id,{src: swf_net_connection_url, cachebusting: true,  wmode: "opaque"}, {
key: '#@d4b87a6528d20d21865' ,
clip:{ onStart:function (){_gaq.push(['_trackEvent','Engagement','Video_play',video_title]);ntptAddPair('action', 'Multimedia'); ntptAddPair('label', 'play_video'); ntptAddPair('valore', video_title); ntptEventTag('ev=sito');}},
playlist: [{
url: '',
urlResolvers: 'bwcheck',
baseUrl: '',
autoPlay: true,
provider: 'pseudostreaming',
duration: video_duration,
scaling: 'fit',
bitrates: [
{url: video_url,bitrate: 400}
]
}],
play: { replayLabel: 'Riproduci il video' },
plugins: {
bwcheck: {
url: swf_url,
netConnectionUrl: swf_net_connection_url
},
pseudostreaming: {
url: swf_pseudostreaming_url
},
openAdStream: {
url: swf_ad_streamer_url,
"autoPlay": true,
"overlays": {
"regions": [{
"id": "my-ad-notice",
"verticalAlign": "top",
"horizontalAlign": "left",
"backgroundColor": "transparent",
"width": "35pct",
"style": ".smalltext { font-family: Georgia, \"Times New Roman\", Times, serif; font-size:10px; }"
}]
},
"ads": {
"servers": [{
"type": "OpenX",
"apiAddress": "http://ad77.neodatagroup.com/ad/mediamond_fplayer.jsp"
}],
"schedule": [{
"zone": "fmt_vast_dm",
"position": "pre-roll",
"notice": {
"show": true,
"region": "my-ad-notice",
"message": "&lt;p class=\"smalltext\" align=\"right\"&gt;Messaggio Promozionale di _seconds_ secondi&lt;/p&gt;"
}
},
{
"zone": "ame_dn_sfila_inter", // zona da modificare in base alla sezione
"position": "pre-roll",
"notice": {
"show": true,
"region": "my-ad-notice",
"message": "&lt;p class=\"smalltext\" align=\"right\"&gt;Messaggio Promozionale di _seconds_ secondi&lt;/p&gt;"
}
},
{
"zone": "vp_1",
"position": "pre-roll",
"notice": {
"show": true,
"region": "my-ad-notice",
"message": "&lt;p class=\"smalltext\" align=\"right\"&gt;Messaggio Promozionale di _seconds_ secondi&lt;/p&gt;"
}
}]
}
}
}
});
}
function FlowPlayerWithHDWithAds( div_id , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , video_duration , video_url , video_url_hd , swf_ad_streamer_url )
{
flowplayer(div_id,{src: swf_net_connection_url, cachebusting: true,  wmode: "opaque"}, {
key: '#@d4b87a6528d20d21865' ,
clip:{ onStart:function (){_gaq.push(['_trackEvent','Engagement','Video_play',video_title]);ntptAddPair('action', 'Multimedia'); ntptAddPair('label', 'play_video'); ntptAddPair('valore', video_title); ntptEventTag('ev=sito');}},
playlist: [{
url: '',
urlResolvers: 'bwcheck',
baseUrl: '',
autoPlay: true,
provider: 'pseudostreaming',
duration: video_duration,
scaling: 'fit',
bitrates: [
{url: video_url,bitrate: 400},
{url: video_url_hd,bitrate: 1200}
]
}],
play: { replayLabel: 'Riproduci il video' },
plugins: {
bwcheck: {
url: swf_url,
netConnectionUrl: swf_net_connection_url
},
pseudostreaming: {
url: swf_pseudostreaming_url
},
openAdStream: {
url: swf_ad_streamer_url,
"autoPlay": true,
"overlays": {
"regions": [{
"id": "my-ad-notice",
"verticalAlign": "top",
"horizontalAlign": "left",
"backgroundColor": "transparent",
"width": "35pct",
"style": ".smalltext { font-family: Georgia, \"Times New Roman\", Times, serif; font-size:10px; }"
}]
},
"ads": {
"servers": [{
"type": "OpenX",
"apiAddress": "http://ad77.neodatagroup.com/ad/mediamond_fplayer.jsp"
}],
"schedule": [{
"zone": "fmt_vast_dm",
"position": "pre-roll",
"notice": {
"show": true,
"region": "my-ad-notice",
"message": "&lt;p class=\"smalltext\" align=\"right\"&gt;Messaggio Promozionale di _seconds_ secondi&lt;/p&gt;"
}
},
{
"zone": "ame_dn_sfila_inter", // zona da modificare in base alla sezione
"position": "pre-roll",
"notice": {
"show": true,
"region": "my-ad-notice",
"message": "&lt;p class=\"smalltext\" align=\"right\"&gt;Messaggio Promozionale di _seconds_ secondi&lt;/p&gt;"
}
},
{
"zone": "vp_1",
"position": "pre-roll",
"notice": {
"show": true,
"region": "my-ad-notice",
"message": "&lt;p class=\"smalltext\" align=\"right\"&gt;Messaggio Promozionale di _seconds_ secondi&lt;/p&gt;"
}
}]
}
}
}
});
}
jQuery(document).ready(function() {
jQuery(".sfogliatore-subcategoria-2011").mouseover(function () {
jQuery(".sfogliatore-subcategoria-2011").removeClass("arancio-2011");
jQuery(this).addClass("arancio-2011");
});
jQuery(".sfogliatore-subcategoria-2011").mouseout(function () {
jQuery(".sfogliatore-subcategoria-2011").removeClass("arancio-2011");
});
});
function comboboxThemes() {
jQuery("#themes").sexyCombo({autofill: true,
triggerSelected:false,
suffix:'_themes',
hiddenSuffix:'_hidden_themes',
emptyText: jQuery("#emptytext_sezioni").html(),
changeCallback: function() {
var label=this.getCurrentTextValue();
var newloc=this.getHiddenValue();
window.location=newloc;return false;
}
});
}
function comboboxMedias() {
jQuery("#medias").sexyCombo({autofill: true,
triggerSelected:false,
suffix:'_medias',
hiddenSuffix:'_hidden_medias',
emptyText: jQuery("#emptytext_media").html(),
changeCallback: function() {
var label=this.getCurrentTextValue();
var newloc=this.getHiddenValue();window.location=newloc;return false;
}
});
}
jQuery(document).ready(function() {
if( jQuery("#themes").length > 0 ) { comboboxThemes(); }
});
jQuery(document).ready(function() {
if( jQuery("#medias").length > 0 ) { comboboxMedias(); }
});
jQuery(document).ready(function (){
var sezione = jQuery("#emptytext_sezioni").html();
var media = jQuery("#emptytext_media").html();
if( sezione && sezione.length > 0 ) { sezione.replace("'", "`"); }
if( media && media.length > 0 ) { media.replace("'", "`"); }
});
jQuery(document).ready(function (){
var index = 0;
if (js_variables["num_common_teq"] == 2) {
index = Math.floor(Math.random()*2);
}
jQuery(".common-test-quiz-"+index).show();
});
function str_replace (search, replace, subject, count) {
j = 0,
temp = '',
repl = '',
sl = 0,        fl = 0,
f = [].concat(search),
r = [].concat(replace),
s = subject,
ra = r instanceof Array,        sa = s instanceof Array;
s = [].concat(s);
if (count) {
this.window[count] = 0;
}
for (i = 0, sl = s.length; i < sl; i++) {
if (s[i] === '') {
continue;
}        for (j = 0, fl = f.length; j < fl; j++) {
temp = s[i] + '';
repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
s[i] = (temp).split(f[j]).join(repl);
if (count && s[i] !== temp) {                this.window[count] += (temp.length - s[i].length) / f[j].length;
}
}
}
return sa ? s : s[0];
}
function getFlashVersion(){
try {
try {
var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
try { axo.AllowScriptAccess = 'always'; }
catch(e) { return '6,0,0'; }
} catch(e) {}
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
} catch(e) {
try {
if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
}
} catch(e) {}
}
return '0,0,0';
}
jQuery(document).ready(function() {
jQuery("#video-channel-player").each(function () {
var video_title = js_variables['video_title'];
var swf_url = js_variables['swf_url'];
var swf_net_connection_url = js_variables['swf_net_connection_url'];
var swf_pseudostreaming_url = js_variables['swf_pseudostreaming_url'];
var swf_ad_streamer_url = js_variables['swf_ad_streamer_url'];
var video_duration = js_variables['video_duration'];
var duration_sec = js_variables['duration_sec'];
var video_url = js_variables['video_url'];
var video_url_hd = js_variables['video_url_hd'];
var videoWidth = js_variables['video_width'];
var videoHeight = js_variables['video_height'];
var pre_roll = js_variables['pre_roll'];
var splash_image = js_variables['splash_image'];
var is_html5_video = js_variables['is_html5_video'];
var autoplay = false;
var html = '';
if( video_title && video_title.length>0 ) {
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
}
else  {
video_title = '';
}
if( video_url && video_url.length>0 ) {
video_url = video_url.replace('"', "");
video_url = video_url.replace('"', "");
video_url = video_url.replace('"', "");
}
if( video_url_hd && video_url_hd.length>0 ) {
video_url_hd = video_url_hd.replace('"', "");
video_url_hd = video_url_hd.replace('"', "");
video_url_hd = video_url_hd.replace('"', "");
}
ntptAddPair('action', 'Multimedia');
ntptAddPair('label', 'play_video');
ntptAddPair('valore', video_title);
ntptEventTag('ev=sito');
if (!is_html5_video){ //se il video è diverso da html 5 lo visualizzo con il flash
if( video_url && video_url.length>0 ) {
html += '<div id="flowPlayer" class="flv2011Container"></div>';
jQuery("#video-channel-player").html(html);
if( pre_roll == 1 ) {
if( video_url_hd.length > 0 ) {
FlowPlayerWithHDWithAds("flowPlayer" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , duration_sec , video_url , video_url_hd , swf_ad_streamer_url )
} else {
FlowPlayerNoHDWithAds("flowPlayer" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , duration_sec , video_url , swf_ad_streamer_url )
}
} else {
if( video_url_hd.length > 0 ) {
FlowPlayerWithHDNoAds("flowPlayer" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , duration_sec , video_url , video_url_hd )
} else {
FlowPlayerNoHDNoAds("flowPlayer" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , duration_sec, video_url )
}
}
}
}else{ //altrimenti, se è html 5 controllo se il browser riproduce video html5
var hasFlash = false;
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if(fo) hasFlash = true;
}catch(e){
if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash = true;
}
var version = getFlashVersion().split(',').shift();
if(hasFlash && version>=9) {
html += '<div id="flowPlayer" class="flv2011Container"></div>';
jQuery("#video-channel-player").html(html);
if( video_url && video_url.length>0 ) {
if( pre_roll == 1 ) {
if( video_url_hd.length > 0 ) {
FlowPlayerWithHDWithAds("flowPlayer" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , duration_sec , video_url , video_url_hd , swf_ad_streamer_url )
} else {
FlowPlayerNoHDWithAds("flowPlayer" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , duration_sec , video_url , swf_ad_streamer_url )
}
} else {
if( video_url_hd.length > 0 ) {
FlowPlayerWithHDNoAds("flowPlayer" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , duration_sec , video_url , video_url_hd )
} else {
FlowPlayerNoHDNoAds("flowPlayer" , autoplay , splash_image , video_title , swf_url , swf_net_connection_url , swf_pseudostreaming_url , duration_sec , video_url )
}
}
}
} else {
var mp4Url = js_variables['mp4Url'];
var webmUrl = js_variables['webmUrl'];
html += "<video class='video-js video-hs' poster='"+splash_image+"' width='"+videoWidth+"' height='"+videoHeight+"' id='video' preload controls>";
html += "<source id='mp4' src="+mp4Url+" type='video/mp4' codecs='avc1.42E01E, mp4a.40.2' />";
html += "<source id='webm' src="+webmUrl+" type='video/webm' codecs='vp8, vorbis' />";
html += "</video>";
jQuery("#video-channel-player").html(html);
jQuery("#video").load();
}
}
});
});
function comboboxPortata() {
jQuery("#ricerca-portata-2011").sexyCombo({autofill: true, triggerSelected:false, suffix:'_ricerca-portata-2011', hiddenSuffix:'_hidden_ricerca-portata-2011', emptyText: "Tutte",filterFn: function() {return true;}	});
}
function comboboxRegione() {
jQuery("#ricerca-regione-2011").sexyCombo({autofill: true, triggerSelected:false, suffix:'_ricerca-regione-2011', hiddenSuffix:'_hidden_ricerca-regione-2011', emptyText: "Regione",filterFn: function() {return true;}	});
}
var nazioni = [
{ idnazione: "", dsnazione: " tutte" }
,{ idnazione: "algeria", dsnazione: "algeria" }
,{ idnazione: "argentina", dsnazione: "argentina" }
,{ idnazione: "australia", dsnazione: "australia" }
,{ idnazione: "austria", dsnazione: "austria" }
,{ idnazione: "belgio", dsnazione: "belgio" }
,{ idnazione: "brasile", dsnazione: "brasile" }
,{ idnazione: "burkina-faso", dsnazione: "burkina faso" }
,{ idnazione: "caraibi", dsnazione: "caraibi" }
,{ idnazione: "cecoslovacchia", dsnazione: "cecoslovacchia" }
,{ idnazione: "cile", dsnazione: "cile" }
,{ idnazione: "cina", dsnazione: "cina" }
,{ idnazione: "corea", dsnazione: "corea" }
,{ idnazione: "costa-d-avorio", dsnazione: "costa d'avorio" }
,{ idnazione: "cuba", dsnazione: "cuba" }
,{ idnazione: "danimarca", dsnazione: "danimarca" }
,{ idnazione: "ecuador", dsnazione: "ecuador" }
,{ idnazione: "egitto", dsnazione: "egitto" }
,{ idnazione: "filippine", dsnazione: "filippine" }
,{ idnazione: "18", dsnazione: "finlandia" }
,{ idnazione: "francia", dsnazione: "francia" }
,{ idnazione: "germania", dsnazione: "germania" }
,{ idnazione: "giamaica", dsnazione: "giamaica" }
,{ idnazione: "giappone", dsnazione: "giappone" }
,{ idnazione: "gran-bretagna", dsnazione: "gran bretagna" }
,{ idnazione: "grecia", dsnazione: "grecia" }
,{ idnazione: "hong-kong", dsnazione: "hong kong" }
,{ idnazione: "india", dsnazione: "india" }
,{ idnazione: "indonesia", dsnazione: "indonesia" }
,{ idnazione: "iran", dsnazione: "iran" }
,{ idnazione: "irlanda-eire", dsnazione: "irlanda-eire" }
,{ idnazione: "israele", dsnazione: "israele" }
,{ idnazione: "italia", dsnazione: "italia" }
,{ idnazione: "kenya", dsnazione: "kenya" }
,{ idnazione: "libano", dsnazione: "libano" }
,{ idnazione: "lussemburgo", dsnazione: "lussemburgo" }
,{ idnazione: "madagascar", dsnazione: "madagascar" }
,{ idnazione: "malaysia", dsnazione: "malaysia" }
,{ idnazione: "malta", dsnazione: "malta" }
,{ idnazione: "marocco", dsnazione: "marocco" }
,{ idnazione: "mauritius", dsnazione: "mauritius" }
,{ idnazione: "messico", dsnazione: "messico" }
,{ idnazione: "monaco", dsnazione: "monaco" }
,{ idnazione: "norvegia", dsnazione: "norvegia" }
,{ idnazione: "olanda", dsnazione: "olanda" }
,{ idnazione: "pakistan", dsnazione: "pakistan" }
,{ idnazione: "peru", dsnazione: "peru" }
,{ idnazione: "polinesia-francese", dsnazione: "polinesia francese" }
,{ idnazione: "polonia", dsnazione: "polonia" }
,{ idnazione: "portogallo", dsnazione: "portogallo" }
,{ idnazione: "russia", dsnazione: "russia" }
,{ idnazione: "scozia", dsnazione: "scozia" }
,{ idnazione: "senegal", dsnazione: "senegal" }
,{ idnazione: "siria", dsnazione: "siria" }
,{ idnazione: "spagna", dsnazione: "spagna" }
,{ idnazione: "sri-lanka", dsnazione: "sri lanka" }
,{ idnazione: "svezia", dsnazione: "svezia"  }
,{ idnazione: "svizzera", dsnazione: "svizzera" }
,{ idnazione: "thailandia", dsnazione: "thailandia" }
,{ idnazione: "tunisia", dsnazione: "tunisia" }
,{ idnazione: "turchia", dsnazione: "turchia" }
,{ idnazione: "u.s.a.", dsnazione: "u.s.a." }
,{ idnazione: "ungheria", dsnazione: "ungheria" }
,{ idnazione: "vietnam-del-nord", dsnazione: "vietnam del nord" }
];
jQuery(document).ready(function() {
jQuery(".ricetta-2011-aggiungi-preferite").each(function(){
var amerg_cookie = getCookie('amerg_cookie');
if ( amerg_cookie == null) {
jQuery(".ricetta-2011-aggiungi-preferite a").attr("href",linkCommunity+"/user/login?destination="+URLEncode(location.href));
jQuery(".ricetta-2011-vai-tua-cucina a").attr("href",linkCommunity+"/user/login?destination=la-tua-cucina");
} else {
jQuery(".ricetta-2011-vai-tua-cucina a").attr("href",linkCommunity+"/la-tua-cucina");
var objectid_ricetta=jQuery(".ricetta-2011-aggiungi-preferite a").attr("id").split("-")[2];
jQuery.ajax({url: linkCommunity+"/community_dm_cucina/check_like_ricetta_ez",
dataType: "jsonp",
data: { "object_id" : objectid_ricetta
},
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
if (data.like==1) {
jQuery(".ricetta-2011-aggiungi-preferite a").html("Togli dalle preferite");
} else {
jQuery(".ricetta-2011-aggiungi-preferite a").html("Aggiungi alle preferite");
}
}
},
error: function(XHR, textStatus, errorThrown){
}
});
jQuery(".ricetta-2011-aggiungi-preferite a").click(function(){
jQuery.ajax({url: linkCommunity+"/community_dm_cucina/like_ricetta_ez",
dataType: "jsonp",
data: { "object_id" : objectid_ricetta,
"title" :jQuery(".aggiungi-preferite-title").html(),
"portata" :jQuery(".aggiungi-preferite-portata").html(),
"link" : location.href,
"immagine" :jQuery(".aggiungi-preferite-immagine").html(),
"nodeid" :jQuery(".aggiungi-preferite-nodeid").html()
},
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
if (data.like==1) {
jQuery(".ricetta-2011-aggiungi-preferite a").html("Togli dalle preferite");
} else {
jQuery(".ricetta-2011-aggiungi-preferite a").html("Aggiungi alle preferite");
}
}
},
error: function(XHR, textStatus, errorThrown){
}
});
});
}
});
if (jQuery("#helpNomeRicetta, #helpIngredienti").length>0) {
jQuery("#helpNomeRicetta, #helpIngredienti").tooltip({
track: true,
delay: 0,
showURL: false,
fixPNG: true,
showBody: " - ",
extraClass: "pretty fancy",
top: -95,
left: -97,
id : 'ricettetooltip'
});
}
if(typeof(titoloRicerca)=="undefined"){
startingPhrase('raNomeRicetta',"Scrivi il nome di una ricetta", "raHNomeRicetta");
}
jQuery('#raHTempo').val(typeof(tempoRicerca)=="undefined"?1:tempoRicerca);
if (jQuery('#raTempo').length>0)
jQuery('#raTempo').slider({range: "min", value:typeof(tempoRicerca)=="undefined"?1:tempoRicerca,markerselected:"/extension/dmcucina/design/ezflow/images/slider-step.gif",marker : "/extension/dmcucina/design/ezflow/images/slider-step-next.gif",change:function(event, ui) {jQuery('#raHTempo').val(ui.value);}});
jQuery('#raHDifficolta').val(typeof(difficoltaRicerca)=="undefined"?1:difficoltaRicerca);
if (jQuery('#raDifficolta').length>0)
jQuery('#raDifficolta').slider({range: "min", value:typeof(difficoltaRicerca)=="undefined"?1:difficoltaRicerca,markerselected:"/extension/dmcucina/design/ezflow/images/slider-step.gif", marker:"/extension/dmcucina/design/ezflow/images/slider-step-next.gif",change:function(event, ui) {jQuery('#raHDifficolta').val(ui.value);}});
jQuery('#raHCalorie').val(typeof(calorieRicerca)=="undefined"?1:calorieRicerca);
if (jQuery('#raCalorie').length>0)
jQuery('#raCalorie').slider({range: "min", value:typeof(calorieRicerca)=="undefined"?1:calorieRicerca,markerselected:"/extension/dmcucina/design/ezflow/images/slider-step.gif",marker:"/extension/dmcucina/design/ezflow/images/slider-step-next.gif",change:function(event, ui) {jQuery('#raHCalorie').val(ui.value);}});
startingPhrase('Ir_ra',"Scrivi una ricetta, un ingrediente, una portata...", "Ir_H_ra");
if (jQuery("#raNazione").length>0) {
jQuery("#raNazione").autocomplete(nazioni, {
minChars: 0,
width: 310,
autoFill: false,
max: 100,
mustMatch: true,
formatItem: function(row, i, max) {
return row.dsnazione;
},
formatMatch: function(row, i, max) {
return row.dsnazione;
},
formatResult: function(row) {
return row.dsnazione;
}
});
}
if (jQuery("#raNazione").length>0) {
jQuery("#raNazione").result(function(event, data, formatted) {
jQuery("#idpaese").val(data["idnazione"]);
if(jQuery("#idpaese").val() != "italia"){
jQuery('#ricerca-regione-2011, input[name="raRegione_hidden_ricerca-regione-2011"]').val("");
jQuery('#ricerca-regione-2011, input[name="raRegione_ricerca-regione-2011"] ').attr("disabled", true);
}else{
jQuery('input[name="raRegione_ricerca-regione-2011"]').removeAttr("disabled");
}
});
}
jQuery('#raNazione').bind('keydown', function(e) {
var key = e.keyCode;
if (key == '8') jQuery('#idpaese').val("");
if (jQuery('#raNazione').val() == "")  jQuery('#idpaese').val("");
});
if( jQuery("#ricerca-portata-2011").length > 0 ) { comboboxPortata(); }
if( jQuery("#ricerca-regione-2011").length > 0 ) { comboboxRegione(); }
jQuery('#ricerca-portata-2011').change(function (){
var portata = jQuery('#ricerca-portata-2011 :selected').text();
if(portata.search("/")>0){
portata=portata.replace("/", "_");
}
if (portata != '') {
var url = '/ezjscore/call/cucina::popolaSelectClassiRicercaAvanzata::'+portata;
jQuery.ajax({
url: url,
success: function(data) {
jQuery('#ricerca-classe-2011').html(data);
}
});
}
});
jQuery('#ricerca-classe-2011').change(function (){
var classe = jQuery('#ricerca-classe-2011 :selected').text();
if (classe != '') {
var url = '/ezjscore/call/cucina::popolaSelectSottoclassiRicercaAvanzata::'+classe;
jQuery.ajax({
url: url,
success: function(data) {
jQuery('#ricerca-sottoclasse-2011').html(data);
}
});
}
});
jQuery('#ricerca-sottoclasse-2011').change(function (){
var classe = jQuery('#ricerca-sottoclasse-2011 :selected').text();
if (classe != '') {
var url = '/ezjscore/call/cucina::popolaSelectMicroclassiRicercaAvanzata::'+classe;
jQuery.ajax({
url: url,
success: function(data) {
jQuery('#ricerca-microclasse-2011').html(data);
}
});
}
});
jQuery("#formRicercaRapida").submit(function() {
if( jQuery("#Ir_ra").val()=="Scrivi una ricetta, un ingrediente, una portata..." ) {
jQuery("#Ir_ra").val("");
}
if (window.linkEz!=undefined) {
window.location.href = window.linkEz+"cucina/risultati-ricette/(searchkey)/"+jQuery('#Ir_ra').val();
} else {
window.location.href = "/cucina/risultati-ricette/(searchkey)/"+jQuery('#Ir_ra').val();
}
return false;
});
});
function inviaForm(){
var href="/cucina/risultati-ricette/";
var tagForm=jQuery('#formRicercaAvanzata');
if (jQuery('#raNomeRicetta').val() != "Scrivi il nome di una ricetta" && jQuery('#raNomeRicetta').val().trim() != "") {
href += "(titolo)/"+jQuery('#raNomeRicetta').val()+"/";
}
if (jQuery('input[name="portata_hidden_ricerca-portata-2011"]').val() != "") {
href += "(portata)/"+jQuery('input[name="portata_hidden_ricerca-portata-2011"]').val() + "/";
}
if (jQuery('input[name="raTempo"]').val() != "1") {
href += "(tempo)/"+jQuery('input[name="raTempo"]').val() + "/";
}
if (jQuery('input[name="raDifficolta"]').val() != "1") {
href += "(difficolta)/"+jQuery('input[name="raDifficolta"]').val() + "/";
}
if (jQuery('input[name="raCalorie"]').val() != "1") {
href += "(calorie)/"+jQuery('input[name="raCalorie"]').val() + "/";
}
if (jQuery('input[name="idpaese"]').val() != "") {
href += "(nazione)/"+jQuery('input[name="idpaese"]').val() + "/";
}
if (jQuery('input[name="raRegione_hidden_ricerca-regione-2011"]').val() != "") {
href += "(regione)/"+jQuery('input[name="raRegione_hidden_ricerca-regione-2011"]').val() + "/";
}
var stringaingredienti = "";
if (jQuery('input[name="ingredienti1"]').val() != "") {
stringaingredienti += jQuery('input[name="ingredienti1"]').val() + "-";
}
if (jQuery('input[name="ingredienti2"]').val() != "") {
stringaingredienti += jQuery('input[name="ingredienti2"]').val() + "-";
}
if (jQuery('input[name="ingredienti3"]').val() != "") {
stringaingredienti += jQuery('input[name="ingredienti3"]').val();
}
if (stringaingredienti ) {
href += "(ingredienti)/" + stringaingredienti + "/";
}
if (ricercaEstesa=='S') {
href += "(advanced)/ext/";
if (jQuery('#ricerca-classe-2011').val() != "") {
href += "(classe)/"+jQuery('#ricerca-classe-2011').val() + "/";
}
if (jQuery('#ricerca-sottoclasse-2011').val() != "") {
href += "(sottoclasse)/" + jQuery('#ricerca-sottoclasse-2011').val() + "/";
}
if (jQuery('#ricerca-microclasse-2011').val() != "") {
href += "(microclasse)/" + jQuery('#ricerca-microclasse-2011').val() + "/";
}
if (jQuery('#ricerca-conservazione-2011').val() != "") {
href += "(conservazione)/" + jQuery('#ricerca-conservazione-2011').val() + "/";
}
if (jQuery('#raTestoRicetta').val() != "") {
href += "(preparazione)/"+jQuery('#raTestoRicetta').val() + "/";
}
if (jQuery('#raAutoreRicetta').val() != "") {
href += "(autore)/"+jQuery('#raAutoreRicetta').val() + "/";
}
if (jQuery('#ricerca-destinatario-2011').val() != "") {
href += "(destinatario)/" + jQuery('#ricerca-destinatario-2011').val() + "/";
}
if (jQuery('#ricerca-occasione-2011').val() != "") {
href += "(occasione)/" + jQuery('#ricerca-occasione-2011').val() + "/";
}
if (jQuery('#ricerca-utilizzo-2011').val() != "") {
href += "(utilizzo)/" + jQuery('#ricerca-utilizzo-2011').val() + "/";
}
if (jQuery('#ricerca-tipo_cucina-2011').val() != "") {
href += "(tipo_cucina)/" + jQuery('#ricerca-tipo_cucina-2011').val() + "/";
}
if (jQuery('#ricerca-tipo_cottura-2011').val() != "") {
href += "(tipo_cottura)/" + jQuery('#ricerca-tipo_cottura-2011').val() + "/";
}
}
window.location.href = href;
return false;
}
function startingPhrase(tagId, text, tagIdH ){
var jqObj = jQuery('#'+tagId);
var jqObjH = jQuery('#'+tagIdH);
jqObj.addClass('startingPhrase');
jqObj.val(text);
jqObjH.val('');
jqObj.focus(function(){
jQuery(this).css('color','#000000');
jQuery(this).removeClass('startingPhrase');
if (jQuery(this).val()==text){
jQuery(this).val('');
}
});
jqObj.blur(function(){
if (jQuery.trim(jQuery(this).val())==''){
jQuery(this).css('color','#999999');
jqObj.addClass('startingPhrase');
jQuery(this).val(text);
jqObjH.val('');
}else{
jqObjH.val(jqObj.val());
}
});
}
String.prototype.trim = function() {
return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,"");
}
function cucinaSlugify(text)
{
text = jQuery.trim(text);
text = text.replace('è', 'e');
text = text.replace('é', 'e');
text = text.replace('à', 'a');
text = text.replace('ù', 'u');
text = text.replace('ì', 'i');
text = text.replace('ò', 'o');
text = text.replace(/[\s]+/g, '-');
text = text.toLowerCase();
return text;
}
if( jQuery("#Regione").length > 0 )
{
jQuery("#Regione").sexyCombo({autofill: true, triggerSelected:false, suffix:'_ricerca-regione-2011', hiddenSuffix:'_hidden_ricerca-regione-2011', emptyText: "Regione",filterFn: function() {return true;} });
}
jQuery(document).ready(function() {
var $imgSrc = '';
if (js_variables["slotMachineSkin"] == 1) {
$imgSrc = js_variables["slotMachineSkinImg"];
jQuery("div.slot-cover-2011").css("background-image", "url("+$imgSrc+")");
}
if (js_variables["logoDxSlotMachine"] == 1) {
$imgSrc = js_variables["logoDxSlotMachineImg"];
jQuery("#wrapper h3").css("background-image", "url("+$imgSrc+")");
}
});
jQuery(document).ready(function() {
jQuery('.slot-stop-2011-1').click(function () {
_gaq.push(['_trackEvent','Engagement','smachine_stop1']);
if (jQuery('.slot-stop-2011-1').hasClass('stopped')) {
jQuery('#slot1').addClass('attiva');
jQuery('.slot-stop-2011-1').removeClass('stopped');
k--;
} else {
jQuery('#slot1').removeClass('attiva');
jQuery('.slot-stop-2011-1').addClass('stopped');
k++;
}
});
jQuery('.slot-stop-2011-2').click(function () {
_gaq.push(['_trackEvent','Engagement','smachine_stop2']);
if (jQuery('.slot-stop-2011-2').hasClass('stopped')) {
jQuery('#slot2').addClass('attiva');
jQuery('.slot-stop-2011-2').removeClass('stopped');
k--;
} else {
jQuery('#slot2').removeClass('attiva');
jQuery('.slot-stop-2011-2').addClass('stopped');
k++;
}
});
jQuery('.slot-stop-2011-3').click(function () {
_gaq.push(['_trackEvent','Engagement','smachine_stop3']);
if (jQuery('.slot-stop-2011-3').hasClass('stopped')) {
jQuery('#slot3').addClass('attiva');
jQuery('.slot-stop-2011-3').removeClass('stopped');
k--;
} else {
jQuery('#slot3').removeClass('attiva');
jQuery('.slot-stop-2011-3').addClass('stopped');
k++;
}
});
var k = 0;
jQuery('.slot-stop-2011 ul li').click(function () {
if (k==3) {
jQuery('#playButton').attr('disabled',true);
} else {
jQuery('#playButton').attr('disabled',false);
}
});
});
var disqus_identifier = 'Slot Machine Ricette';
var slotVisibile = new Array(0,1,1,1);
jQuery(document).ready(function () {
function salvaRicetteMenu(){
var amerg_cookie = getCookie('amerg_cookie');
var link = 'la-mia-cucina/salva-menu/ricetta/'+jQuery('input[name$="objId-ricetta-1-'+slotVisibile[1]+'"]').val();
link += '/ricetta/'+jQuery('input[name$="objId-ricetta-2-'+slotVisibile[2]+'"]').val();
link += '/ricetta/'+jQuery('input[name$="objId-ricetta-3-'+slotVisibile[3]+'"]').val();
if ( amerg_cookie == null) {
link = '/user/login?destination='+link;
}
window.location.href = link;
}
jQuery('#wrapper h3 span a').click(function () {salvaRicetteMenu();});
function randomRange(minNum, maxNum) {
var multiplier = maxNum-minNum+1;
return Math.floor(Math.random()*multiplier+minNum);
}
jQuery('.slot').each( function(){
var currentList = jQuery(this);
var firstItem = currentList.children('li:first');
firstItem.clone().appendTo( currentList );
var myList = currentList.children('li');
var listHeight = -( firstItem.outerHeight() * ( myList.length-1) );
if ( jQuery.browser.msie ) {
if( jQuery.browser.version.substring(0,1) == '8' ) listHeight = listHeight - 20;
if( jQuery.browser.version.substring(0,1) == '7' )
{
jQuery('.slot li h4').css('position','relative');
jQuery('.slot li h4').css('z-index','-1');
jQuery('.slot li').css('position','relative');
jQuery('.slot li').css('z-index','-2');
jQuery('#slotWrapper').css('position','relative');
jQuery('#slotWrapper').css('z-index','9999');
jQuery('#controls').css('z-index','10000');
}
}
currentList.css('margin-top',listHeight);
})
function playSlots() {
isPlaying = true
slotNumber = jQuery('.slot.attiva').length
var slot = 0;
var slot_counter = 0;
jQuery('.slot.attiva').each( function(){
slot++;
var currentList = jQuery(this)
var firstItem = currentList.children('li:first')
var myList = currentList.children('li')
var listHeight = -( firstItem.outerHeight() * ( myList.length-1) )
var spinSpeed = 200
function lowerSpeed() {
if ( spinSpeed < 1000 ) {
spinSpeed +=200
spinEm()
} else {
spinSpeed +=200
var myNum = randomRange(1, (myList.length-1) )
var finalPos = - ( (firstItem.outerHeight() * myNum)-firstItem.outerHeight() )
var finalSpeed = ( (spinSpeed * .5) * (myList.length-1) ) / myNum
function checkWinner() {
slot_counter++;
if( slot_counter == slot )
{
isPlaying = false;
jQuery('#playButton').attr('disabled',false);
jQuery('.slot li h4').css('z-index','1');
if ( jQuery.browser.msie && jQuery.browser.version.substring(0,1) == '7' )
{
jQuery('.attiva li h4').css('visibility','visible');
jQuery('#slotWrapper').css('z-index','3');
jQuery('.slot li').css('z-index','4');
jQuery('.slot li h4').css('z-index','5');
}
jQuery('.slot-stop-2011 ul li').css('visibility','visible');
jQuery('.slot-cover-2011').removeClass('slot-cover-2011-attivo');
}
}
if ( jQuery.browser.msie && jQuery.browser.version.substring(0,1)!='7' ) {
finalPos = finalPos-20;
}
var myslotcounter=currentList.attr("id").substring(4);
slotVisibile[myslotcounter] = myNum;
currentList.css('margin-top',listHeight).animate( {'margin-top': finalPos}, finalSpeed, 'swing', function(event, complete) {checkWinner();} );
}
}
function spinEm() {
currentList.css('margin-top',listHeight).animate( {'margin-top': '0px'}, spinSpeed, 'linear', lowerSpeed );
if (jQuery(".slot").hasClass("attiva")) {
jQuery('.attiva li h4').css('z-index','-1');
if ( jQuery.browser.msie && jQuery.browser.version.substring(0,1)=='7' ) {
jQuery('.slot li h4').css('position','relative');
jQuery('.slot li h4').css('z-index','-1');
jQuery('.slot li').css('position','relative');
jQuery('.slot li').css('z-index','-2');
jQuery('#slotWrapper').css('position','relative');
jQuery('#slotWrapper').css('z-index','1');
jQuery('.slot-stop-2011 ul li').not('.stopped').css('visibility','hidden');
jQuery('.attiva li h4').css('visibility','hidden');
jQuery('.slot-cover-2011').css('position','relative');
jQuery('.slot-cover-2011').css('z-index','2');
jQuery('#title-slot1').css('z-index','3');
jQuery('#title-slot2').css('z-index','3');
jQuery('#title-slot3').css('z-index','3');
jQuery('#title-slot3').css('z-index','3');
jQuery('.slot-stop-2011').css('z-index','3');
}
jQuery('.slot-stop-2011 ul li').not('.stopped').css('visibility','hidden');
}
}
spinEm()
});
}
isPlaying = false
jQuery('#playButton').click(function(){
_gaq.push(['_trackEvent','Engagement','smachine_leva']);
playSlots()
jQuery(this).attr('disabled',true);
jQuery('.slot-cover-2011').addClass('slot-cover-2011-attivo');
});
jQuery('#slot1 li h4 a').click(function(){
_gaq.push(['_trackEvent','Engagement','smachine_ricetta1']);
});
jQuery('#slot1 a img').click(function(){
_gaq.push(['_trackEvent','Engagement','smachine_fotoricetta1']);
});
jQuery('#slot2 li h4 a').click(function(){
_gaq.push(['_trackEvent','Engagement','smachine_ricetta2']);
});
jQuery('#slot2 a img').click(function(){
_gaq.push(['_trackEvent','Engagement','smachine_fotoricetta2']);
});
jQuery('#slot3 li h4 a').click(function(){
_gaq.push(['_trackEvent','Engagement','smachine_ricetta3']);
});
jQuery('#slot3 a img').click(function(){
_gaq.push(['_trackEvent','Engagement','smachine_fotoricetta3']);
});
});
window.fbAsyncInit = function() {
FB.init({appId: '218317100612'
, status: true
, cookie: true
, xfbml: true
, channelUrl: 'http://'+location.host+'/channel.html'
});
FB.Event.subscribe('edge.create', function(href, widget) {
href=href.split(/\?|#/)[0];
_gaq.push(["_trackEvent","Social","FBLike", currentSocialTitle ]);
slug=href.split("/");
slug.splice(0,3);
slugcompleto=slug.join("/");
slugconunderscore=slug.join("_");
title=jQuery("."+slugconunderscore+"_title").html();
body=jQuery("."+slugconunderscore+"_body").html();
object_id=jQuery("."+slugconunderscore+"_object_id").html();
if (href=="http://www.facebook.com/DonnaModerna") {
jQuery("#counter-principale-fb").html(parseInt(jQuery("#counter-principale-fb").html())+1);
ntptAddPair('action', 'Home');
ntptAddPair('label', 'like_fan_page');
ntptAddPair('valore', '');
ntptEventTag('ev=social');
} else {
ntptAddPair('action', 'Button');
ntptAddPair('label', 'like');
ntptAddPair('valore', currentSocialTitle);
ntptEventTag('ev=social');
contatore=jQuery("."+slugconunderscore+"_counter");
if (isNaN(parseInt((contatore).html()))) {
contatore.html("1");
} else {
contatore.html(parseInt((contatore).html())+1);
}
jQuery("."+slugconunderscore+"_counter").show();
jQuery("."+slugconunderscore+"_border").hide();
}
jQuery.ajax({url: linkCommunity+"/community_ame_like/like",
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
data : {"type":"facebook"
,"slug":slugcompleto
,"name":getNickName()
,"title":title
,"body":body
,"object_id":object_id
}
});
});
FB.Event.subscribe('edge.remove', function(href, widget) {
href=href.split(/\?|#/)[0];
slug=href.split("/");
slug.splice(0,3);
slugconunderscore=slug.join("_");
if (href=="http://www.facebook.com/DonnaModerna") {
jQuery("#counter-principale-fb").html(parseInt(jQuery("#counter-principale-fb").html())-1);
} else {
contatore=jQuery("."+slugconunderscore+"_counter");
if (parseInt(contatore.html())>1) {
contatore.html(parseInt(contatore.html())-1);
contatore.removeClass("dm2011_social-hidden");
} else {
contatore.html("");
contatore.removeClass("dm2011_social-hidden");
}
jQuery("."+slugconunderscore+"_border").show();
}
});
jQuery(".dm2011_facebook-counter").each(function () {
url=jQuery(this).html();
fbid=jQuery(this).attr("id");
FB.api(
{
method: 'fql.query',
query: 'SELECT "'+fbid+'",like_count FROM link_stat WHERE "'+url+'" IN url'
},
function(response) {
jQuery("#"+response[0].anon).html(response[0].like_count);
if(response[0].like_count != 0) {
jQuery("#"+response[0].anon).show();
jQuery("#"+response[0].anon).removeClass("dm2011_social-hidden");
}
}
);
jQuery('#'+fbid+"default").hide();
});
jQuery(".dm2011_facebook-page-counter").each(function () {
fbid=jQuery(this).attr("id");
FB.api(
{
method: 'fql.query',
query: 'SELECT "'+fbid+'",total_count FROM link_stat WHERE "http://www.facebook.com/DonnaModerna" IN url'
},
function(response) {
jQuery("#"+response[0].anon).html(response[0].total_count);
}
);
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/it_IT/all.js';
if (document.getElementById('fb-root')!=null) {
document.getElementById('fb-root').appendChild(e);
}
}());
jQuery(document).ready(function(){
jQuery("#dm2011_BIGplayer").each(function () {
});
});
jQuery(document).ready(function(){
jQuery("#BIGplayer").each(function () {
var video_title = js_variables['video_title_flowplayer'];
if( video_title && video_title.length>0 ) {
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
video_title = video_title.replace("'", "`");
}
ntptAddPair('action', 'Multimedia');
ntptAddPair('label', 'play_video');
ntptAddPair('valore', video_title);
ntptEventTag('ev=sito');
});
});
function calcolaPathAvatarCommenti(nome,dimensione) {
if (nome==undefined) {
return linkCommunity+"/sites/all/themes/community_dm/img/avatar_"+dimensione+".jpg";
}
var pathAvatar = linkCommunity+"/sites/default/files/pictures/a_";
timestamp=new Date().getTime();
nickSlugify = nome.replace('@','chiocciola');
lengthNick = nickSlugify.length;
if (lengthNick >= 3) {
pathAvatar += nickSlugify.substr(0, 3);
} else {
pathAvatar += nickSlugify;
}
if (nickSlugify.substring(0, 1)==".") {
nickSlugify="avatar"+nickSlugify;
}
pathAvatar += "/" + nickSlugify + "_"+dimensione+".jpg?"+timestamp;
return pathAvatar;
}
function goToLocation(data, classe) {
var newlocation=location.href.split(/\?|#/)[0] + classe;
if (data!=undefined) {
if(data.object_id.substring(0, 1)=='d') {
location.href=newlocation;
location.reload(true);
} else {
location.href="/dmcommunity/updateNumberComments?object_id="+data.object_id+"&counter="+data.countertotal+"&returnUrl="+URLEncode(newlocation);
}
} else {
location.href=newlocation;
location.reload(true);
}
}
jQuery(document).ready(function(){
var amerg_cookie = getCookie('amerg_cookie');
bindSubmitCommenti(jQuery(".dm2011_mainformwrapper"));
jQuery(".dm2011_commenti").each(function() {
ids=jQuery(this).attr("id").split("_");
object_id=ids[1];
url=jQuery(".dm2011_form-commenti .dm2011_comment-url").val();
old_slug=jQuery(".dm2011_form-commenti .dm2011_comment-oldslug").val();
offset=jQuery(".dm2011_form-commenti .dm2011_comment-offset").val();
if (amerg_cookie==null) {
jQuery.ajax({url: linkCommunity+"/scripts/jsonp/get_json_file_commenti.php",
data : {"object_id":object_id,"old_slug":old_slug,"url":url,"offset":offset},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
if (data.counter==null || data.counter==0) {
jQuery("#numero_commenti_"+data.object_id).html("Commenta");
} else {
if (data.counter==1) {
jQuery("#numero_commenti_"+data.object_id).html("1 commento");
jQuery(".dm2011_numerocommentiarticolo").html("1");
} else {
jQuery("#numero_commenti_"+data.object_id).html(data.counter+" commenti");
jQuery(".dm2011_apricommenti").parent().show();
jQuery(".dm2011_numerocommentiarticolo").html(data.counter);
}
}
if (data.commenti!=null) {
for(i=0;i<data.commenti.length;i++) {
aggiungiElementoCommento(data.commenti,i);
}
}
}
jQuery(".dm2011_commentiwaiter").hide();
}
});
} else {
jQuery.ajax({url: linkCommunity+"/community_ame_comments/gruppo_commenti",
data : {"object_id":object_id,
"limit":5,
"offset":offset,
"index":0,
"amerg_cookie":amerg_cookie},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data.counter==null || data.counter==0) {
jQuery("#numero_commenti_"+data.object_id).html("Commenta");
} else {
if (data.counter==1) {
jQuery("#numero_commenti_"+data.object_id).html("1 commento");
jQuery(".dm2011_numerocommentiarticolo").html("1");
} else {
jQuery("#numero_commenti_"+data.object_id).html(data.counter+" commenti");
jQuery(".dm2011_apricommenti").parent().show();
jQuery(".dm2011_numerocommentiarticolo").html(data.counter);
}
}
if (data.commenti!=null) {
for(i=0;i<data.commenti.length;i++) {
aggiungiElementoCommento(data.commenti,i);
}
}
jQuery(".dm2011_commentiwaiter").hide();
}
});
}
});
jQuery(".dm2011_apricommenti").click(function() {
jQuery(".dm2011_commentiwaiter").show();
ids=jQuery(this).attr("id").split("_");
objectid=ids[1];
index=ids[2];
offset=jQuery(".dm2011_form-commenti .dm2011_comment-offset").val();
index_succ=parseInt(index)+1;
jQuery(this).attr("id","apricommenti_"+objectid+"_"+index_succ);
jQuery.ajax({url: linkCommunity+"/community_ame_comments/gruppo_commenti",
data : {"object_id":objectid,
"limit":5,
"offset":offset,
"index":index,
"amerg_cookie":amerg_cookie},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined && data.commenti!=null) {
for(i=0;i<data.commenti.length;i++) {
aggiungiElementoCommento(data.commenti,i);
}
}
jQuery(".dm2011_commentiwaiter").hide();
}
});
});
function aggiungiElementoCommento(data,i) {
if (data[i].last=="true") {
jQuery(".dm2011_apricommenti").parent().hide();
} else {
if (data[i].figli>0) {
jQuery(".dm2011_reference-comment-wrapper .dm2011_risposte_commento").show();
jQuery(".dm2011_reference-comment-wrapper .dm2011_rispostecommento").html(data[i].figli);
} else {
jQuery(".dm2011_reference-comment-wrapper .dm2011_risposte_commento").hide();
}
sostituisciValoriCommentoRiferimento(data,i,"dm2011_reference-comment-wrapper");
rispondiid="rispondi_"+data[i].cid;
risposteid="risposte_"+data[i].cid+"_0";
cancellaid="cancella_"+data[i].cid;
jQuery(".dm2011_reference-comment-wrapper .dm2011_risposte_commento").attr("id",risposteid);
jQuery(".dm2011_reference-comment-wrapper .dm2011_comment-delete").attr("id",cancellaid);
jQuery(".dm2011_reference-comment-wrapper .dm2011_comment-pid").val(data[i].cid);
jQuery(".dm2011_reference-comment-wrapper .comment-wrapper").attr("id","dm2011-commentcid-"+data[i].cid);
jQuery(".dm2011_commenti").append(jQuery(".dm2011_reference-comment-wrapper").html());
jQuery(".dm2011_reference-comment-wrapper .dm2011_risposte_commento").attr("id","idqualsiasi2");
jQuery(".dm2011_reference-comment-wrapper .dm2011_comment-delete").attr("id","idqualsiasi3");
jQuery(".dm2011_reference-comment-wrapper .comment-wrapper").attr("id","idqualsiasi4");
attaccaEventiThumbCommento(data[i].cid);
jQuery("#dm2011-commentcid-"+data[i].cid+" .dm2011_commentrispondi").click(function(){
jQuery(".dm2011_subcommentform-wrapper").hide();
jQuery(".dm2011_commentrispondi").show();
jQuery(".dm2011_subcommentform-wrapper",jQuery(this).parent()).show();
bindSubmitCommenti(jQuery(this).parent());
jQuery(this).hide();
});
attivaBottoneCancella(cancellaid,data,i);
jQuery("#"+risposteid+" a").click(function(){
ids=jQuery(this).parent().attr("id").split("_");
cid=ids[1];
index=ids[2];
index_succ=parseInt(index)+1;
jQuery(this).parent().attr("id","risposte_"+cid+"_"+index_succ);
jQuery(this).attr("id","risposte_"+cid);
rimasti=parseInt(jQuery(".dm2011_rispostecommento",this).html())-5;
if (rimasti<0) { rimasti=0; }
jQuery(".dm2011_rispostecommento",this).html(rimasti);
jQuery(".dm2011_subcommentiwaiter",jQuery(this).parent().parent()).show();
jQuery.ajax({url: linkCommunity+"/community_ame_comments/gruppo_commentifigli",
data : {"pid": cid,"amerg_cookie":amerg_cookie,"limit":5,"index":index},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
pid=data[0].pid;
for(i=0;i<data.length;i++) {
aggiungiElementoSottoCommento(data,i,pid);
}
}
jQuery(".dm2011_subcommentiwaiter",jQuery("#risposte_"+data[0].pid).parent().parent()).hide();
}
});
});
}
}
function attaccaEventiThumbCommento(cid) {
slug=jQuery(".dm2011_comment-url").val() + '#dm2011_dilatua';
object_id=jQuery(".dm2011_comment-object_id").val();
jQuery.ajax({
jsonp: "jsoncallback",
url: linkCommunity+'/scripts/jsonp/get_numero_like.php',
data: {slug: slug,
object_id : object_id,
"name":getNickName(),
type:'comment',
id:cid,
cid:cid},
dataType: 'jsonp',
success: function(data) {
if (data!=undefined && data.count>0) {
jQuery("#dm2011-commentcid-"+data.id+" .dm2011_thumb-comment-counter").html(data.count);
jQuery("#dm2011-commentcid-"+data.id+" .dm2011_thumb-comment-counter").show();
if (data.allow=="false") {
commento=jQuery("#dm2011-commentcid-"+data.id+" .dm2011_thumb-comment");
commento.unbind();
jQuery("img",commento).attr("src",jQuery("img",commento).attr("src").replace("-over",""));
jQuery(commento).css("cursor","default");
jQuery(commento).attr("title","Hai votato");
}
}
}
});
jQuery("#dm2011-commentcid-"+cid+" .dm2011_thumb-comment").click(function() {
contatore=jQuery(".dm2011_thumb-comment-counter",jQuery(this).parent());
numerillo=parseInt(contatore.html());
if (isNaN(numerillo)) {
contatore.html(1);
} else {
contatore.html(numerillo+1);
}
contatore.show();
cid=jQuery(this).parent().parent().parent().parent().attr("id").split("-")[2];
if (cid==undefined) {
cid=jQuery(this).parent().parent().parent().attr("id").split("-")[2];
}
slug=jQuery(".dm2011_comment-url").val() + '#dm2011_dilatua';
title=jQuery(".dm2011_comment_nodetitle").html();
body=jQuery("#dm2011-commentcid-"+cid+" .dm2011_comment_body").html();
object_id=jQuery(".dm2011_comment-object_id").val();
jQuery.ajax({url: linkCommunity+"/community_ame_like/like",
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
data : {"type":"comment"
,"slug":slug
,"name":getNickName()
,"title":title
,"body":body
,"object_id":object_id
,"id":cid
}
});
jQuery(this).unbind();
jQuery("img",this).attr("src",jQuery("img",this).attr("src").replace("-over",""));
jQuery(this).css("cursor","default");
jQuery(this).attr("title","Hai votato");
return false;
});
}
function aggiungiElementoSottoCommento(data,i,pid) {
if (data[i].last=="true") {
jQuery("#risposte_"+pid).parent().hide();
} else {
sostituisciValoriCommentoRiferimento(data,i,"dm2011_reference-rispostecommento-wrapper");
cancellaid="cancella_"+data[i].cid;
jQuery(".dm2011_reference-rispostecommento-wrapper .dm2011_comment-delete").attr("id",cancellaid);
jQuery(".dm2011_reference-rispostecommento-wrapper .subcomment-wrapper").attr("id","dm2011-commentcid-"+data[i].cid);
jQuery("#risposte_"+data[i].pid).parent().parent().prepend(jQuery(".dm2011_reference-rispostecommento-wrapper").html());
jQuery(".dm2011_reference-rispostecommento-wrapper .dm2011_comment-delete").attr("id","idqualsiasi10");
jQuery(".dm2011_reference-rispostecommento-wrapper .subcomment-wrapper").attr("id","idqualsiasi11");
attivaBottoneCancella(cancellaid,data,i);
attaccaEventiThumbCommento(data[i].cid);
}
}
function attivaBottoneCancella(cancellaid,data,i) {
jQuery("#"+cancellaid).click(function(){
messaggioconferma("Vuoi veramente cancellare il commento?","cancellapopup_"+cancellaid+"_"+data[i].object_id,function (){
id=jQuery(".dm2011_messaggioGenerico").attr("id").split("_");
offset=jQuery(".dm2011_form-commenti .dm2011_comment-offset").val();
jQuery.ajax({url: linkCommunity+"/community_ame_comments/elimina_commento_esterno",
data: { "cookie" : amerg_cookie,
"cid" : id[2],
"object_id" : id[3],
"offset" : offset
},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 10000,
success: function(data) {
goToLocation(data, '#2011_dilatua');
},
error: function(XHR, textStatus, errorThrown){
}
});
});
});
attivaBottoneCancellaGruppi2011("#"+cancellaid, cancellaid, data, i);
}
function attivaBottoneCancellaGruppi2011(ele, cancellaid, data, i){
if(jQuery(ele).attr('class').indexOf('dm2011_comment_gruppi_activating') >= 0){
jQuery(ele).show();
jQuery(ele).unbind();
jQuery(ele).click(function(){
messaggioconferma("Vuoi veramente cancellare il commento?","cancellapopup_"+cancellaid+"_"+data[i].object_id,function (){
id=jQuery(".dm2011_messaggioGenerico").attr("id").split("_");
offset=jQuery(".dm2011_form-commenti .dm2011_comment-offset").val();
jQuery.ajax({url: linkCommunity+"/community_dm_gruppi_2011_comments/elimina_commento_esterno",
data: { "cookie" : amerg_cookie,
"cid" : id[2],
"object_id" : id[3],
"offset" : offset
},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 10000,
success: function(data) {
goToLocation(data, '#2011_dilatua');
},
error: function(XHR, textStatus, errorThrown){
}
});
});
});
}
}
function sostituisciValoriCommentoRiferimento(data,i,riferimento) {
if (data[i].cancella=="true") {
jQuery("."+riferimento+" .dm2011_comment-delete").show();
} else {
jQuery("."+riferimento+" .dm2011_comment-delete").hide();
}
jQuery("."+riferimento+" .dm2011_comment_name").html(data[i].name);
jQuery("."+riferimento+" .dm2011_comment_date").html(data[i].date_formatted);
jQuery("."+riferimento+" .dm2011_comment_body").html(data[i].comment);
if (data[i].uid!="0") {
pathAvatar=calcolaPathAvatarCommenti(data[i].name,"50x50");
jQuery("."+riferimento+" .dm2011_comment_avatar").attr("src",pathAvatar);
linkutente=linkCommunity+"/amiche/"+data[i].name;
jQuery("."+riferimento+" .dm2011_comment_name").css("cursor","pointer");
jQuery("."+riferimento+" .dm2011_comment_avatar").parent().css("cursor","pointer");
} else {
pathAvatar=calcolaPathAvatarCommenti(undefined,"50x50");
jQuery("."+riferimento+" .dm2011_comment_avatar").attr("src",pathAvatar);
linkutente="javascript:void(0)";
jQuery("."+riferimento+" .dm2011_comment_name").css("cursor","default");
jQuery("."+riferimento+" .dm2011_comment_avatar").parent().css("cursor","default");
}
jQuery("."+riferimento+" .dm2011_comment_name").attr("href",linkutente);
jQuery("."+riferimento+" .dm2011_comment_avatar").parent().attr("href",linkutente);
}
if ( amerg_cookie == null) {
} else {
var nickname = amerg_cookie.split('*')[1];
pathAvatar=calcolaPathAvatarCommenti(nickname,"50x50");
jQuery(".dm2011_comment_form_avatar img").attr("src",pathAvatar);
jQuery(".dm2011_comment_form_name").hide();
jQuery(".dm2011_comment_form_mail").hide();
jQuery(".di-la-tua-input-text-name-label").hide();
jQuery(".di-la-tua-input-text-email-label").hide();
jQuery(".di-la-tua-subinput-text-name-label").hide();
jQuery(".di-la-tua-subinput-text-email-label").hide();
jQuery(".dm2011_comment_form_myname").html(nickname);
jQuery(".dm2011_comment_form_myname").show();
}
});
function messaggiogenerico(messaggio) {
var div= "<div class='dm2011_messaggioGenerico'>" + messaggio + "<br/><br/>" + "<a href='javascript:void(0)' onclick='jQuery.unblockUI()' class='comment-rispondi'>Chiudi</a>";
jQuery.blockUI({ message: div,  css:   { border:     '1px solid #D1D1D1', background: '#78828E', color:'white',padding : '10px'}});
return false;
}
function messaggioconferma(messaggio,id,funzione) {
var div= "<div class='dm2011_messaggioGenerico' id='"+id+"'>" + messaggio + "<br/><br/>" + "<a href='javascript:void(0)' class='dm2011_popup_conferma dm2011_popupbutton comment-rispondi'>Conferma</a><a href='javascript:void(0)' onclick='jQuery.unblockUI()' class='dm2011_popupbutton comment-rispondi'>Annulla</a>";
jQuery.blockUI({ message: div,  css:   { border:     '1px solid #D1D1D1', background: '#78828E', color:'white',padding : '10px'}});
jQuery(".dm2011_popup_conferma").click(funzione);
return false;
}
function bindSubmitCommenti(context) {
jQuery('.dm2011_form-commenti',context).submit(function() {
jQuery(".dm2011_inviacommento").attr('disabled', 'disabled');
amerg_cookie = getCookie('amerg_cookie');
commento=jQuery(".dm2011_form_comment",this).val();
if (commento=="" || commento=="Scrivi qui il tuo commento...") {
jQuery(".dm2011_inviacommento").attr('disabled', '');
messaggiogenerico("Inserisci un commento");return false;
};
nome=jQuery(".dm2011_comment_form_name",this).val();
mail=jQuery(".dm2011_comment_form_mail",this).val();
if ((amerg_cookie==undefined || amerg_cookie=="") && (nome=="" || mail=="")) {
jQuery(".dm2011_inviacommento").attr('disabled', '');
messaggiogenerico("Inserisci nome e e-mail");return false;
};
if ((amerg_cookie==undefined || amerg_cookie=="") && (!check_email(mail))) {
jQuery(".dm2011_inviacommento").attr('disabled', '');
messaggiogenerico("Inserisci un indirizzo e-mail valido");return false;
};
var object_id=jQuery(".dm2011_comment-object_id",this).val();
var old_slug=jQuery(".dm2011_comment-oldslug",this).val();
var offset=jQuery(".dm2011_comment-offset",this).val();
var creator=jQuery(".dm2011_comment_creator").html();
jQuery.ajax({url: linkCommunity+"/community_ame_comments/inserisci_commento_esterno",
data: { "comment" :commento,
"cookie" : amerg_cookie,
"name" : nome,
"external_author_id":creator,
"offset" : offset,
"object_id" : object_id,
"old_slug" : old_slug,
"url" : jQuery(".dm2011_comment-url",this).val(),
"mail" :mail,
"pid" : jQuery(".dm2011_comment-pid",this).val()
},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 10000,
success: function(data) {
goToLocation(data, '#dm2011_dilatua');
},
error: function(XHR, textStatus, errorThrown){
}
});
return false;
});
}
function check_email(email){
emailRegExp = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
return emailRegExp.test(email);
}
var autoplay_attivo=0;
function openWindowGallery()
{
if (autoplay_attivo)
window.open(js_variables["galleryBaseUrl"]+"/foto-"+js_variables["galleryImgSucc"]+"/"+js_variables["galleryAutoplayText"]+"/1#title","_self");
}
function play()
{
jQuery("#containerAutoplay").attr("title", "PAUSE");
jQuery("#containerAutoplay").html("PAUSE");
jQuery("#containerAutoplay").css("background-position", "-105px -795px");
}
function pause() {
autoplay_attivo=0;
jQuery("#containerAutoplay").attr("title", "PLAY");
jQuery("#containerAutoplay").html("PLAY");
jQuery("#containerAutoplay").css("background-position", "-105px -769px");
}
function autoplay() {
if (autoplay_attivo == 0) {
autoplay_attivo=1;
play();
setTimeout("openWindowGallery()", 3000);
}
else {
autoplay_attivo=0;
pause();
}
}
jQuery(document).ready(function() {
if (window.js_variables && js_variables["galleryAutoplayFlag"] == 1) {
autoplay();
}
});
function addOkNotizie(id_container,title, url) {
url = encodeURIComponent(url);
jQuery("#"+id_container).append('<a href="#" title="Condividi su OKNOtizie"><img src="http://oknotizie.virgilio.it/images/oknotizie.png" width="16" height="16" alt="Condividi su OkNotizie" border="0"/></a>');
jQuery('#'+id_container+' a').bind('click', function(){
window.open('http://oknotizie.virgilio.it/post.html.php?url=' + url + '&title=' + title );
return true;
});
}
function addLikeFb(id_container,title, url, width) {
jQuery("#"+id_container).append('<fb:like href="'+ url +'?utm_medium=social&utm_source=facebook&utm_campaign=like" layout="button_count" show_faces="false" width="'+width+'"></fb:like>');
}
function addTwitter(id_container,title, url) {
jQuery("#"+id_container).append('<a href="http://twitter.com/share" class="twitter-share-button" data-url="'+url+'?utm_medium=social&utm_source=twitter&utm_campaign=tweet" data-count="none" data-lang="it"  onclick="_gaq.push([\'_trackEvent\',\'Social\',\'Tweet\',\''+title+'\']);">Tweet</a>');
}
jQuery(document).ready(function() {
if (jQuery("a.imgzoom").length>0) {
jQuery("a.imgzoom").fancybox({
'overlayOpacity'    :   0.7,
'overlayColor'      :   '#000',
'titlePosition'     :   'outside',
'zoomSpeedIn'           : 300,
'zoomSpeedOut'          : 300,
'zoomOpacity'           : true,
'hideOnContentClick'    : false,
'padding'                : 0
});
}
});
if (window.js_variables && js_variables["sfilate2011"] != undefined) {
jQuery(document).ready(function(){
jQuery('#pane4').jScrollPane({scrollbarWidth:15, dragMaxHeight:19});
setTimeout('resizescroll()',1500);
jQuery("#DM-sfilate-collezione").sexyCombo({
autofill: false,
triggerSelected:true
});
jQuery("#DM-sfilate-stagione").sexyCombo({
autofill: false,
triggerSelected:true
});
jQuery("#DM-sfilate-luogo").sexyCombo({
autofill: false,
triggerSelected: true
});
jQuery("#DM-sfilate-stilista").sexyCombo({
autofill: false,
triggerSelected:true
});
jQuery("#DM-sfilate-collezione").change(function() {
valueCat = jQuery(this).siblings("input:hidden").val().split("/");
if (valueCat[4] != js_variables["sfilate2011_bc_0"]) {
window.location.href=jQuery(this).siblings("input:hidden").val();
}
});
jQuery("#DM-sfilate-stagione").change(function() {
valueCat = jQuery(this).siblings("input:hidden").val().split("/");
if (valueCat[5] != js_variables["sfilate2011_bc_1"]) {
window.location.href=jQuery(this).siblings("input:hidden").val();
}
});
jQuery("#DM-sfilate-luogo").change(function() {
valueCat = jQuery(this).siblings("input:hidden").val().split("/");
if (valueCat[6] != js_variables["sfilate2011_bc_2"]) {
window.location.href=jQuery(this).siblings("input:hidden").val();
}
});
jQuery("#DM-sfilate-stilista").change(function() {
valueCat = jQuery(this).siblings("input:hidden").val().split("/");
if (valueCat.length <= 7)
valueCat[7]='tutti';
if (valueCat[7] != js_variables["sfilate2011_bc_3"]) {
window.location.href=jQuery(this).siblings("input:hidden").val();
}
});
jQuery('.sfilate-bottoni-2011').hover(function() {
jQuery(this).children('a').addClass("sfilate-2011-active");
});
jQuery('.sfilate-bottoni-2011').mouseleave(function() {
jQuery(this).children('a').removeClass('sfilate-2011-active');
});
});
var url = document.location.href;
var encUrl = encodeURIComponent(url);
var socialUrl = js_variables["sfilate2011_socialURL"];
var title = js_variables["sfilate2011_socialTitle"];
var isStilista = js_variables["sfilate2011_bc_3"];
var title_page = js_variables["sfilate2011_nodeName"];
title_page = title_page.replace("'", "`");
jQuery(document).ready(function(){
addOkNotizie("social-oknotizie-sfilate2011",title, encUrl);
jQuery('#social-mail-sfilate2011').click(function() {
jQuery('#mailcontainer').ez("fashion::tipafriend2011::"+js_variables["sfilate2011_mailParams"], {}, null, function() {jQuery("#open-tip-form").click();});
});
addLikeFb("social-fb-like",title, socialUrl,'110');
addTwitter("social-twitter-sfilate2011",title, socialUrl);
});
}
if (window.js_variables && js_variables["socialbar"] != undefined) {
var url = (document.location.href.split('?'))[0];
url = (document.location.href.split('#'))[0];
if (js_variables["socialbar_URL"] != undefined) {
url = js_variables["socialbar_URL"];
}
var title = js_variables["socialbar_title"];
addOkNotizie("social-oknotizie",title, url);
var title_page = js_variables["socialbar_title_page"];
title_page = title_page.replace("'", "`");
jQuery(document).ready(function(){
addLikeFb("social-fb-like",title_page, url, '450');
addTwitter("social-twitter",title_page, url);
});
}
if (window.js_variables && js_variables["tipafriend"] != undefined) {
jQuery(document).ready(function(){
jQuery.ajax(
{
type: "POST",
url: "/tipafriend/get",
data: js_variables["tipafriend_data"],
success:function(t){
jQuery('#tpf-'+js_variables["tipafriend_tip_node_id"]).empty();
jQuery('#tpf-'+js_variables["tipafriend_tip_node_id"]).append(t);
}
});
});
}
if (window.js_variables && js_variables["contacalorie"] != undefined) {
jQuery(document).ready(function(){
initContacalorie();
});
}
if (window.js_variables && js_variables["gallery_top5"] != undefined) {
jQuery(document).ready(function(){
function toggleElement(element,show){
element.addClass( show ? "visible" : "invisible" );
element.removeClass( show ? "invisible" : "visible" );
}
function toggleAccordionElement(element,show){
toggleElement(element.children().eq(0),show);
toggleElement(element.children().eq(1),!show);
}
jQuery('#accordion').children().click(function(){
if ( jQuery(this).children().eq(0).hasClass('invisible') ){
var siblingsNode = jQuery(this).siblings();
toggleAccordionElement(siblingsNode.eq(0),false);
toggleAccordionElement(siblingsNode.eq(1),false);
toggleAccordionElement(siblingsNode.eq(2),false);
toggleAccordionElement(siblingsNode.eq(3),false);
toggleAccordionElement(jQuery(this),true);
}
else{}
});
jQuery(".top-five-testo").children().addClass("top-five-intro");
});
}
if (window.js_variables && js_variables["top5_carousel"] != undefined) {
jQuery(document).ready(function() {
jQuery('.jcarousel-skin-top5').jcarousel({scroll:3,animation: 1000});
});
}
jQuery(document).ready(function() {
if (jQuery('#cucina-hp-carousel').length>0) {
jQuery('#cucina-hp-carousel').jcarousel({
wrap: 'circular',
initCallback: hpCucinaInEvidenzaCarousel_initCallback
});
}
if (jQuery('#ricette-carousel-2011').length>0) {
jQuery('#ricette-carousel-2011').jcarousel({
auto: 400,
wrap: 'circular',
scroll: 4,
initCallback: mycarousel_initCallback
});
}
if (jQuery('#gallery-carousel-2011').length>0) {
jQuery('#gallery-carousel-2011').jcarousel({
auto: 400,
wrap: 'circular',
scroll: 6,
initCallback: mycarousel_initCallback
});
}
if (jQuery('#video-channel-video-piu-recenti-carousel').length>0) {
jQuery('#video-channel-video-piu-recenti-carousel').jcarousel({
wrap: 'circular',
scroll: 5,
initCallback: mycarousel_initCallback
});
}
});
var prefisso="dm";
function getCookie(NameOfCookie) {
if (document.cookie.length > 0) {
begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1) {
begin += NameOfCookie.length+1;
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end));
}
}
return null;
}
function calcolaPathAvatar(nome,dimensione) {
if (nome==undefined) {
return linkCommunity+"/sites/all/themes/community_dm/img/avatar_"+dimensione+".jpg";
}
var pathAvatar = linkCommunity+"/sites/default/files/pictures/a_";
timestamp=new Date().getTime();
nickSlugify = nome.replace('@','chiocciola');
lengthNick = nickSlugify.length;
if (lengthNick >= 3)
pathAvatar += nickSlugify.substr(0, 3);
else
pathAvatar += nickSlugify;
if (nickSlugify.substring(0, 1)==".") {
nickSlugify="avatar"+nickSlugify;
}
pathAvatar += "/" + nickSlugify + "_"+dimensione+".jpg?"+timestamp;
return pathAvatar;
}
var amerg_cookie="";
function getNickName() {
var amerg_cookie = getCookie('amerg_cookie');
var nickname = '';
if (amerg_cookie!=undefined) {
if (amerg_cookie!=null){
nickname = amerg_cookie.split('*')[1];
nickname=nickname.replace(/"/g,'');
}
}
return nickname;
}
jQuery(document).ready(function(){
jQuery('.dm2011_fbcontainer').mouseover(function(e){
jQuery('#facebook-message').css({'top': (e.pageY + 10) + 'px','left': (e.pageX + 10) + 'px','display':'block'});
}).mouseout(function(){jQuery('#facebook-message').hide();});
jQuery('.dm2011_tweet').mouseover(function(e){
jQuery('#twitter-message').css({'top': (e.pageY + 10) + 'px','left': (e.pageX + 10) + 'px','display':'block'});
}).mouseout(function(){jQuery('#twitter-message').hide();});
});
jQuery(document).ready(function(){
var nome_file="/scripts/jsonp/get_json_file.php";
var nickname=getNickName();
if ( nickname != "") {
nome_file="/community_dm_external_widgets/sociosfera_jsonp";
}
var nomeUtente = ''; // nome dell'utente da visualizzare
var nomeUtenteLen = 12; // lunghezza massima nome utente da visualizzare
jQuery(".DM-sociosfera-2011").each(function () {
jQuery.ajax({url: linkCommunity+nome_file,
data : {"nomefile":"ultimi_like.json",
"cookie":getCookie('amerg_cookie')},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
dati="";
for(i=0;i<data.length;i++) {
jQuery("#dm2011_sociosfera_title_"+i).html(data[i].title);
jQuery("#dm2011_sociosfera_title_"+i).attr("title",data[i].title);
if (data[i].type=="twitter") {
jQuery("#dm2011_sociosfera_type_"+i).addClass("DM-like-box-tw");
}
if (data[i].type=="facebook") {
jQuery("#dm2011_sociosfera_type_"+i).addClass("DM-like-box-fb");
}
if (data[i].type=="thumb" || data[i].type=="comment") {
jQuery("#dm2011_sociosfera_type_"+i).addClass("DM-like-box-th");
}
jQuery("#dm2011_sociosfera_type_"+i).html(data[i].type);
if (window.linkEz!=undefined) {
if (data[i].object_id.substring(0,1)=="d") {
jQuery("#dm2011_sociosfera_title_"+i).attr("href",linkCommunity+"/"+data[i].slug);
} else if (data[i].object_id.substring(0,1)=="v"){
jQuery("#dm2011_sociosfera_title_"+i).attr("href",linkForum+"/"+data[i].slug);
} else {
jQuery("#dm2011_sociosfera_title_"+i).attr("href",window.linkEz+"/"+data[i].slug);
}
} else {
if (data[i].object_id.substring(0,1)=="d") {
jQuery("#dm2011_sociosfera_title_"+i).attr("href",linkCommunity+"/"+data[i].slug);
} else if (data[i].object_id.substring(0,1)=="v"){
jQuery("#dm2011_sociosfera_title_"+i).attr("href",linkForum+"/"+data[i].slug);
} else {
jQuery("#dm2011_sociosfera_title_"+i).attr("href","/"+data[i].slug);
}
}
if ((data[i].count-1)==1) {
jQuery("#dm2011_sociosfera_container_"+i).html('&nbsp;e&nbsp;<span id="dm2011_sociosfera_count_'+i+'" class="DM-like-box-testo-evidenziato">'+ (data[i].count-1) +'</span>&nbsp;altra&nbsp;persona');
}
else {
jQuery("#dm2011_sociosfera_count_"+i).html(data[i].count-1);
}
if (data[i].name=="") {
jQuery("#dm2011_sociosfera_image_"+i).css("cursor","default");
jQuery("#dm2011_sociosfera_name_"+i).html("anonimo");
} else {
var nomeUtente = data[i].name;
var nomeUtenteOriginale=nomeUtente;
if(nomeUtente.length > nomeUtenteLen) {
nomeUtente = nomeUtente.substring(0, nomeUtenteLen) + "...";
}
jQuery("#dm2011_sociosfera_name_"+i).html('<a href="'+linkCommunity+'/amiche/'+data[i].name+'">'+nomeUtente+'</a>');
pathAvatar=calcolaPathAvatar(nomeUtenteOriginale,"50x50");
jQuery("#dm2011_sociosfera_image_"+i).attr("src", pathAvatar.toLowerCase());
jQuery("#dm2011_sociosfera_image_"+i).parent().attr("title", nomeUtenteOriginale);
jQuery("#dm2011_sociosfera_image_"+i).parent().attr("href", linkCommunity+"/amiche/"+nomeUtenteOriginale);
}
if (data[i].count<=1) {
jQuery("#dm2011_sociosfera_container_"+i).hide();
}
}
}
jQuery(".DM-like-box-testo h4").each(function(){
if(jQuery(this).height() == 14) {
jQuery(this).parent().css('padding-top', '8px');
jQuery(this).parent().css('height', '35px');
}
});
}
});
});
attaccaEventiThumb();
});
jQuery(document).ready(function(){
var twid=new Array();
jQuery(".dm2011_twitter-page-counter").each(function () {
screenname="DonnaModerna";
twid_page=jQuery(this).attr("id");
jQuery.ajax({
twid: twid[screenname],
url: 'http://api.twitter.com/1/users/show.json',
data: {screen_name: screenname},
dataType: 'jsonp',
success: function(data) {
jQuery('#'+twid_page).html(data.followers_count);
jQuery('#'+twid_page).show();
}
});
});
jQuery(".dm2011_twitter-counter").each(function () {
url=jQuery(this).html();
slug=url.split("/");
slug.splice(0,3);
slugcompleto=slug.join("/");
slugconunderscore=slug.join("_");
twid[url+"/"]=slugconunderscore+"_twcounter";
jQuery.ajax({
url: 'http://urls.api.twitter.com/1/urls/count.json',
data: {url: url},
dataType: 'jsonp',
success: function(data) {
jQuery('.'+twid[data.url]).html(data.count);
if(data.count != 0) {
jQuery('.'+twid[data.url]).show();
jQuery('.'+twid[data.url]).removeClass("dm2011_social-hidden");
}
}
});
});
jQuery(".dm2011_tweet").click(function() {
var contatore = jQuery(".dm2011_twitter-counter",jQuery(this).parent().parent());
contatore.html(parseInt(contatore.html())+1).show().removeClass("dm2011_social-hidden");
var shareurl = "http://twitter.com/share?original_referer=" + encodeURIComponent(document.location.href.split('?')[0].split('#')[0]) + "&source=tweetbutton";
shareurl += "&text=" + Url.encode( jQuery(this).attr("data-text") );
shareurl += "&via=" + Url.encode( jQuery(this).attr("data-via") );
shareurl += "&url=" + Url.encode( jQuery(this).attr("data-url") );
window.open(shareurl, "dm2011_twitter", "top=10,left=10,width=500,height=300,status=no,menubar=no,toolbar=no,scrollbars=no");
var slug = Url.decode( jQuery(this).attr("data-url").split('?')[0] ).split("/").slice(3);
slugconunderscore = slug.join("_");
var content_type="twitter";
if(jQuery("."+slugconunderscore+"_content_type").length>0) {
content_type="twitter/"+jQuery("."+slugconunderscore+"_content_type").html();
}
jQuery.ajax({url: linkCommunity+"/community_ame_like/like",
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
data : { "type":content_type,
"slug":slug.join("/"),
"name":getNickName(),
"title":jQuery("."+slugconunderscore+"_title").html(),
"body":jQuery("."+slugconunderscore+"_body").html(),
"object_id":jQuery("."+slugconunderscore+"_object_id").html()
}
});
return false;
});
});
var Url = {
encode : function (string) {
return escape(this._utf8_encode(string));
},
decode : function (string) {
return this._utf8_decode(unescape(string));
},
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
function attaccaEventiThumb() {
jQuery(".dm2011_thumb-trigger").each(function () {
var slug=jQuery(".dm2011_thumb-url",jQuery(this).parent()).html();
var objectid=jQuery(".dm2011_thumb-objectid",jQuery(this).parent()).html();
jQuery.ajax({
jsonp: "jsoncallback",
url: linkCommunity+'/scripts/jsonp/get_numero_like.php',
data: {slug: slug,
"name":getNickName(),
type:'thumb',
object_id:objectid,
id:objectid},
dataType: 'jsonp',
success: function(data) {
if (data!=undefined && data.count>0) {
jQuery(".dm2011_thumb_"+data.id+"_counter").html(data.count);
jQuery(".dm2011_thumb_"+data.id+"_counter").show();
jQuery(".dm2011_thumb_"+data.id+"_counter").removeClass("dm2011_social-hidden");
if (data.allow=="false") {
commento=jQuery(".dm2011_thumb",jQuery(".dm2011_thumb_"+data.id).parent());
commento.unbind();
jQuery("img",commento).attr("src",jQuery("img",commento).attr("src").replace("-over",""));
jQuery(commento).css("cursor","default");
jQuery(commento).attr("title","Hai votato");
}
}
}
});
});
jQuery(".dm2011_thumb").click(function() {
var object_id=jQuery(".dm2011_thumb-objectid",jQuery(this).parent()).html();
var contatore=jQuery(".dm2011_thumb_"+object_id+"_counter");
var numerillo=parseInt(contatore.html());
if (isNaN(numerillo)) {
contatore.html(1);
} else {
contatore.html(numerillo+1);
}
contatore.show();
contatore.removeClass("dm2011_social-hidden");
slug=jQuery(".dm2011_thumb-url",jQuery(this).parent()).html();
title=jQuery(".dm2011_thumb-title",jQuery(this).parent()).html();
var content_type="thumb";
if(jQuery(".dm2011_thumb-content-type",jQuery(this).parent()).length>0) {
content_type="thumb/"+jQuery(".dm2011_thumb-content-type",jQuery(this).parent()).html();
}
jQuery.ajax({url: linkCommunity+"/community_ame_like/like",
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
data : {"type":content_type
,"slug":slug
,"name":getNickName()
,"title":title
,"body":""
,"object_id":object_id
,"cookie":"true"
}
});
var commento=jQuery(".dm2011_thumb",jQuery(".dm2011_thumb_"+object_id).parent());
commento.unbind();
jQuery("img",commento).attr("src",jQuery("img",commento).attr("src").replace("-over",""));
commento.css("cursor","default");
commento.attr("title","Hai votato");
return false;
});
}
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
function URLEncode (clearString) {
var output = '';
var x = 0;
clearString = clearString.toString();
var regex = /(^[a-zA-Z0-9_.]*)/;
while (x < clearString.length) {
var match = regex.exec(clearString.substr(x));
if (match != null && match.length > 1 && match[1] != '') {
output += match[1];
x += match[1].length;
} else {
if (clearString[x] == ' ')
output += '+';
else {
var charCode = clearString.charCodeAt(x);
var hexVal = charCode.toString(16);
output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
}
x++;
}
}
return output;
}
function set_cookie( name, value, expires, path, domain, secure ){
var today = new Date();
today.setTime( today.getTime() );
var amerg_cookie = name + "=" +escape( value );
if ( expires && expires>0 ) {
expires = expires * 60 * 60 * 24;
var expires_date = new Date( today.getTime() + (expires) );
amerg_cookie += ";expires=" + expires_date.toGMTString() ;
}else if ( expires==0 ) {
var today = new Date();
var date = new Date( today.getTime() -3600 );
amerg_cookie += ";expires=" + date.toGMTString() ;
}
amerg_cookie += ( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
document.cookie = amerg_cookie;
}
function getCookie(NameOfCookie) {
if (document.cookie.length > 0) {
begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1) {
begin += NameOfCookie.length+1;
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
var cookieValue= unescape(document.cookie.substring(begin, end));
if (cookieValue != null && (cookieValue!='undefined') && (typeof cookieValue != 'undefined') ){
return cookieValue;
}
}
}
return null;
}
function getIdUtente() {
var amerg_cookie = getCookie(COOKIE_NAME);
var idUtente = '';
if (amerg_cookie!=undefined) {
if (amerg_cookie!=null){
idUtente = amerg_cookie.split('*')[0];
}
}
return idUtente;
}
if (!fromCommunity){
var amerg_cookie = getCookie(COOKIE_NAME);
if  (amerg_cookie != null && (amerg_cookie!='undefined') && (typeof amerg_cookie != 'undefined') ){
var idUtente = getIdUtente();
var isConnectUserAuthentificateJson = urlConnectIsUserAuthentificated + '?idUtente='+ idUtente+'&area='+ AREA +'&applicazione='+ APPLICAZIONE +'&urlRitorno=REST&callback=?';
jQuery.getJSON(isConnectUserAuthentificateJson, function(data) {
if (data!=null) {
if (data.status=='true'){//evita il loop nel caso in cui non sono logato nei due sistemi
}
else{
delete_cookie( COOKIE_NAME, "/", COOKIE_DOMAIN );
window.location.reload();
}
}
});
} else {
jQuery.getJSON(urlConnectGetUserStatus+'?area='+ AREA +'&applicazione='+ APPLICAZIONE +'&urlRitorno=REST&callback=?', function(data) {
if (data!=null){
if (data.COOKIE_VALUE!=''){
set_cookie(COOKIE_NAME,""+data.COOKIE_VALUE, -1 ,"/",COOKIE_DOMAIN,"");
}
}
showBoxLoginStatus();
});
}
}
function showBoxLoginStatus(){
var amerg_cookie = getCookie(COOKIE_NAME);
if ( amerg_cookie == null) {
jQuery(".servizi-regis > a").attr('href',linkCommunity+ '/registrazione?urlRitorno='+ URLEncode(window.location.href) );
jQuery(".servizi-login").show();
jQuery(".servizi-regis").show();
jQuery(".connect2011_login").click(mostrabloccologin);
if (!fromCommunity){
urlRitorno = URLEncode(window.location.href);
jQuery('.servizi-facebook').html('<iframe src="'+ urlConnect +'/app/register/base/facebookButton?refresh=true&view=top&area='+ AREA +'&applicazione='+ APPLICAZIONE +'&urlRitorno=' + urlRitorno +'" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="82" height="18"></iframe>');
}
} else {
jQuery(".servizi-profilo").show();
jQuery(".servizi-nome").show();
var nickname = '';
if (amerg_cookie!=null){
nickname = amerg_cookie.split('*')[1];
if (nickname!=null && nickname!=''){
nickname = nickname.replace(/"/g,'');
}
}
if (!fromCommunity){
urlRitorno = URLEncode(linkCommunity + '?redirectTo=' + URLEncode(window.location.href));
}else{
urlRitorno = URLEncode(window.location.href);		}
jQuery(".servizi-nome").html("<a href='"+linkCommunity+"/amiche/"+nickname+"'>Ciao "+ fitText(nickname,20)+"!</a>");
jQuery(".servizi-src").css("margin-left",300);
jQuery(".connect2011_profilo").click(mostra_dati_personali);
jQuery('.servizi-facebook').html('');
}
}
function fitText(text,length){
var newText = '';
if (length!=null && text!=null && text!=''){
if (text.length>=length){
newText = text.substring(0,length);
}else{
newText = text;
}
}
return newText;
}
function getNickName() {
var amerg_cookie = getCookie(COOKIE_NAME);
var nickname = '';
if (amerg_cookie!=undefined) {
if (amerg_cookie!=null){
nickname = amerg_cookie.split('*')[1];
nickname=nickname.replace(/"/g,'');
}
}
return nickname;
}
function mostra_dati_personali() {
var amerg_cookie = getCookie(COOKIE_NAME);
var nickname = '';
nickname = getNickName();
if (nickname==null) nickname='';
jQuery('.connect2011_profilo').unbind();
jQuery(".connect2011_profilo").click(function(){
jQuery('.connect2011_profilo').unbind();
jQuery('#box-profilo-2011').fadeOut();
jQuery(".connect2011_profilo").click(mostra_dati_personali);
});
if(amerg_cookie.split('*').length > 0) {
var position_login = jQuery(this).offset();
jQuery.ajax({url: linkCommunity+"/connect/datipersonali",
dataType: "jsonp",
data: { "nickname" : nickname , "cookie" :getCookie(COOKIE_NAME), "urlRitorno" : URLEncode(window.location.href)},
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
jQuery('#box-profilo-2011').html(data.item);
var cssObj = {
'top': position_login.top+22,
'left': position_login.left-109,
'z-index': 500
}
jQuery('#box-profilo-2011').css(cssObj);
jQuery('#box-profilo-2011').fadeIn();
jQuery('#box-profilo-2011').mouseleave(function() {
});
jQuery('.imposta-profilo-2011 #urlAccount').attr('href', urlConnect + '/account?area='+ AREA +'&applicazione='+ APPLICAZIONE + '&urlRitorno=' + URLEncode(window.location.href));
}
},
error: function(XHR, textStatus, errorThrown){
}
});
}
}
function mostrabloccologin() {
jQuery('.connect2011_login').unbind();
jQuery(".connect2011_login").click(function(){
jQuery('.connect2011_login').unbind();
jQuery('#box-login-2011').fadeOut();
jQuery(".connect2011_login").click(mostrabloccologin);
});
urlRitorno = window.location.href;
jQuery.ajax({url: linkCommunity+"/scripts/jsonp/get_json_file_boxlogin.php",
data : {"nomefile":"box_login.json", "urlRitorno":"" + URLEncode(urlRitorno) },
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data){
if (data!=undefined) {
var position_login = jQuery(".connect2011_login").offset();
jQuery('#box-login-2011').html(data.item);
jQuery('#urlRitorno').val(urlRitorno);
var cssObj = {
'top': position_login.top+22,
'left': position_login.left-90,
'z-index': 500
}
jQuery('#box-login-2011').css(cssObj);
jQuery('#box-login-2011').fadeIn();
jQuery('#box-login-2011').mouseleave(function() {
});
jQuery('#iframe-fb-button').attr('src', urlConnect+'/app/register/base/facebookButton?refresh=true&view=loginbox&area=' + AREA + '&applicazione=' + APPLICAZIONE + '&urlRitorno=' + urlRitorno);
}
},
error: function(XHR, textStatus, errorThrown){
}
});
}
jQuery(document).ready(function() {
jQuery("#pa2011_seguicisutwitter_counter").each(function () {
var screenname="panoramauto";
var twid_page=jQuery(this).attr("id");
jQuery.ajax({
url: 'http://api.twitter.com/1/users/show.json',
data: {screen_name: screenname},
dataType: 'jsonp',
success: function(data) {
jQuery('#'+twid_page).html(data.followers_count);
jQuery('#'+twid_page).show();
}
});
});
});
jQuery(document).ready(function() {
for (var variabile in js_variables) {
nome=variabile.split("_")[0];
if (nome=="poll") {
nodeid=variabile.split("_")[1];
jQuery("a.view-poll"+nodeid).click(function() {
var nodeId = jQuery(this).parent().parent().attr("id").split('_');
var url = 'poll::view::'+nodeId[1];
jQuery("#box-poll_"+nodeId[1]).ez(url);
return false;
});
jQuery('input.action-poll'+nodeid).click(function() {
var pollInfo_value = jQuery("input[@name='ContentObjectAttribute_data_option_value_"+nodeid+"']:checked");
if (pollInfo_value.length==0) {
alert("Scegli un'opzione per poter votare");
}
else {
var poll_title = js_variables[variabile];
poll_title.replace("'", "`");
_gaq.push(['_trackEvent','Engagement','Sondaggio',js_variables[variabile]]);
var pollInfo = pollInfo_value.val().split('_');
var url = 'poll::vote::'+pollInfo[1]+'::'+pollInfo[2];
var parName = 'ContentObjectAttribute_data_option_value_'+ pollInfo[3];
var strParams = "{"+ parName +" : '"+ pollInfo[4] +"' }";
var params = eval( "("+ strParams +")" );
jQuery("#box-poll_"+pollInfo[1]).ez(url,params);
}
return false;
});
}
}
});
var currentSocialTitle = '';
jQuery("ul.header-social").hover(function(){currentSocialTitle = "DonnaModerna";});
jQuery(".social-bar-sfilate2011").hover(function(){currentSocialTitle = js_variables["sfilate2011_socialURL"];});
jQuery(".social_bar_container_div_attr").hover(function(){currentSocialTitle = jQuery(this).nextAll("div.dm2011_social-hidden").first().html();});
jQuery(".social_bar_container_span_attr").hover(function(){currentSocialTitle = jQuery(this).nextAll("span.dm2011_social-hidden").first().html();});
jQuery("a.dm2011_tweet").click(function(){_gaq.push(['_trackEvent','Social','Tweet', currentSocialTitle ]);ntptAddPair('action', 'Button'); ntptAddPair('label', 'tweet'); ntptAddPair('valore', currentSocialTitle); ntptEventTag('ev=social');});
jQuery(document).ready(function() {
jQuery('#quiz_test').submit(function() {
if (jQuery("input:radio[name='response"+js_variables["question_response"]+"']").is(":checked")) {
return true;
} else {
alert('Per proseguire è necessario rispondere alla domanda.');
return false;
}
});
jQuery('#dm-tq-save').click(function() {
var amerg_cookie = getCookie('amerg_cookie');
if ( amerg_cookie == null) {
var linkSave = jQuery(this).attr('href');
linkSave = js_variables["dom_save_quiz"]+"/user/login?returnUrl=" + encodeURI(linkSave);
jQuery(this).attr('href', linkSave);
}
});
});
function unserialize (data) {
var that = this;
var utf8Overhead = function (chr) {
var code = chr.charCodeAt(0);
if (code < 0x0080) {
return 0;
}
if (code < 0x0800) {
return 1;
}
return 2;
};
var error = function (type, msg, filename, line) {
throw new that.window[type](msg, filename, line);
};
var read_until = function (data, offset, stopchr) {
var buf = [];
var chr = data.slice(offset, offset + 1);
var i = 2;
while (chr != stopchr) {
if ((i + offset) > data.length) {
error('Error', 'Invalid');
}
buf.push(chr);
chr = data.slice(offset + (i - 1), offset + i);
i += 1;
}
return [buf.length, buf.join('')];
};
var read_chrs = function (data, offset, length) {
var buf;
buf = [];
for (var i = 0; i < length; i++) {
var chr = data.slice(offset + (i - 1), offset + i);
buf.push(chr);
length -= utf8Overhead(chr);
}
return [buf.length, buf.join('')];
};
var _unserialize = function (data, offset) {
var readdata;
var readData;
var chrs = 0;
var ccount;
var stringlength;
var keyandchrs;
var keys;
if (!offset) {
offset = 0;
}
var dtype = (data.slice(offset, offset + 1)).toLowerCase();
var dataoffset = offset + 2;
var typeconvert = function (x) {
return x;
};
switch (dtype) {
case 'i':
typeconvert = function (x) {
return parseInt(x, 10);
};
readData = read_until(data, dataoffset, ';');
chrs = readData[0];
readdata = readData[1];
dataoffset += chrs + 1;
break;
case 'b':
typeconvert = function (x) {
return parseInt(x, 10) !== 0;
};
readData = read_until(data, dataoffset, ';');
chrs = readData[0];
readdata = readData[1];
dataoffset += chrs + 1;
break;
case 'd':
typeconvert = function (x) {
return parseFloat(x);
};
readData = read_until(data, dataoffset, ';');
chrs = readData[0];
readdata = readData[1];
dataoffset += chrs + 1;
break;
case 'n':
readdata = null;
break;
case 's':
ccount = read_until(data, dataoffset, ':');
chrs = ccount[0];
stringlength = ccount[1];
dataoffset += chrs + 2;
readData = read_chrs(data, dataoffset + 1, parseInt(stringlength, 10));
chrs = readData[0];
readdata = readData[1];
dataoffset += chrs + 2;
if (chrs != parseInt(stringlength, 10) && chrs != readdata.length) {
error('SyntaxError', 'String length mismatch');
}
break;
case 'a':
readdata = {};
keyandchrs = read_until(data, dataoffset, ':');
chrs = keyandchrs[0];
keys = keyandchrs[1];
dataoffset += chrs + 2;
for (var i = 0; i < parseInt(keys, 10); i++) {
var kprops = _unserialize(data, dataoffset);
var kchrs = kprops[1];
var key = kprops[2];
dataoffset += kchrs;
var vprops = _unserialize(data, dataoffset);
var vchrs = vprops[1];
var value = vprops[2];
dataoffset += vchrs;
readdata[key] = value;
}
dataoffset += 1;
break;
default:
error('SyntaxError', 'Unknown / Unhandled data type(s): ' + dtype);
break;
}
return [dtype, dataoffset - offset, typeconvert(readdata)];
};
return _unserialize((data + ''), 0)[2];
}
function utf8_decode (str_data) {
var tmp_arr = [],
i = 0,
ac = 0,
c1 = 0,
c2 = 0,
c3 = 0;
str_data += '';
while (i < str_data.length) {
c1 = str_data.charCodeAt(i);
if (c1 < 128) {
tmp_arr[ac++] = String.fromCharCode(c1);
i++;
} else if (c1 > 191 && c1 < 224) {
c2 = str_data.charCodeAt(i + 1);
tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = str_data.charCodeAt(i + 1);
c3 = str_data.charCodeAt(i + 2);
tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return tmp_arr.join('');
}
(function(window, undefined){
var document = window.document;
(function(){var initializing=false, fnTest=/xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; this.JRClass = function(){}; JRClass.extend = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function JRClass() { if ( !initializing && this.init ) this.init.apply(this, arguments); } JRClass.prototype = prototype; JRClass.constructor = JRClass; JRClass.extend = arguments.callee; return JRClass;};})();
var VideoJS = JRClass.extend({
init: function(element, setOptions){
if (typeof element == 'string') {
this.video = document.getElementById(element);
} else {
this.video = element;
}
this.video.player = this;
this.values = {}; // Cache video values.
this.elements = {}; // Store refs to controls elements.
this.options = {
autoplay: true,
preload: true,
useBuiltInControls: false, // Use the browser's controls (iPhone)
controlsBelow: false, // Display control bar below video vs. in front of
controlsAtStart: false, // Make controls visible when page loads
controlsHiding: true, // Hide controls when not over the video
defaultVolume: 0.85, // Will be overridden by localStorage volume if available
playerFallbackOrder: ["flash", "html5", "links"], // Players and order to use them
flashPlayer: "htmlObject",
flashPlayerVersion: false // Required flash version for fallback
};
if (typeof VideoJS.options == "object") { _V_.merge(this.options, VideoJS.options); }
if (typeof setOptions == "object") { _V_.merge(this.options, setOptions); }
if (this.getPreloadAttribute() !== undefined) { this.options.preload = this.getPreloadAttribute(); }
if (this.getAutoplayAttribute() !== undefined) { this.options.autoplay = this.getAutoplayAttribute(); }
this.box = this.video.parentNode;
this.linksFallback = this.getLinksFallback();
this.hideLinksFallback(); // Will be shown again if "links" player is used
this.each(this.options.playerFallbackOrder, function(playerType){
if (this[playerType+"Supported"]()) { // Check if player type is supported
this[playerType+"Init"](); // Initialize player type
return true; // Stop looping though players
}
});
this.activateElement(this, "player");
this.activateElement(this.box, "box");
},
behaviors: {},
newBehavior: function(name, activate, functions){
this.behaviors[name] = activate;
this.extend(functions);
},
activateElement: function(element, behavior){
if (typeof element == "string") { element = document.getElementById(element); }
this.behaviors[behavior].call(this, element);
},
errors: [], // Array to track errors
warnings: [],
warning: function(warning){
this.warnings.push(warning);
this.log(warning);
},
history: [],
log: function(event){
if (!event) { return; }
if (typeof event == "string") { event = { type: event }; }
if (event.type) { this.history.push(event.type); }
if (this.history.length >= 50) { this.history.shift(); }
try { console.log(event.type); } catch(e) { try { opera.postError(event.type); } catch(e){} }
},
setLocalStorage: function(key, value){
if (!localStorage) { return; }
try {
localStorage[key] = value;
} catch(e) {
if (e.code == 22 || e.code == 1014) { // Webkit == 22 / Firefox == 1014
this.warning(VideoJS.warnings.localStorageFull);
}
}
},
getPreloadAttribute: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("preload")) {
var preload = this.video.getAttribute("preload");
if (preload === "" || preload === "true") { return "auto"; }
if (preload === "false") { return "none"; }
return preload;
}
},
getAutoplayAttribute: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("autoplay")) {
var autoplay = this.video.getAttribute("autoplay");
if (autoplay === "false") { return false; }
return true;
}
},
bufferedPercent: function(){ return (this.duration()) ? this.buffered()[1] / this.duration() : 0; },
each: function(arr, fn){
if (!arr || arr.length === 0) { return; }
for (var i=0,j=arr.length; i<j; i++) {
if (fn.call(this, arr[i], i)) { break; }
}
},
extend: function(obj){
for (var attrname in obj) {
if (obj.hasOwnProperty(attrname)) { this[attrname]=obj[attrname]; }
}
}
});
VideoJS.player = VideoJS.prototype;
VideoJS.player.extend({
flashSupported: function(){
if (!this.flashElement) { this.flashElement = this.getFlashElement(); }
if (this.flashElement && this.flashPlayerVersionSupported()) {
return true;
} else {
return false;
}
},
flashInit: function(){
this.replaceWithFlash();
this.element = this.flashElement;
this.video.src = ""; // Stop video from downloading if HTML5 is still supported
var flashPlayerType = VideoJS.flashPlayers[this.options.flashPlayer];
this.extend(VideoJS.flashPlayers[this.options.flashPlayer].api);
(flashPlayerType.init.context(this))();
},
getFlashElement: function(){
var children = this.video.children;
for (var i=0,j=children.length; i<j; i++) {
if (jQuery(children[i]).hasClass('vjs-flash-fallback')) {
return children[i];
}
}
},
replaceWithFlash: function(){
this.flashElement = this.video.removeChild(this.flashElement);
if (this.flashElement) {
this.box.insertBefore(this.flashElement, this.video);
this.video.style.display = "none"; // Removing it was breaking later players
}
},
flashPlayerVersionSupported: function(){
var playerVersion = (this.options.flashPlayerVersion) ? this.options.flashPlayerVersion : VideoJS.flashPlayers[this.options.flashPlayer].flashPlayerVersion;
return VideoJS.getFlashVersion() >= playerVersion;
}
});
VideoJS.flashPlayers = {};
VideoJS.flashPlayers.htmlObject = {
flashPlayerVersion: 9,
init: function() { return true; },
api: { // No video API available with HTML Object embed method
width: function(width){
if (width !== undefined) {
this.element.width = width;
this.triggerResizeListeners();
return this;
}
return this.element.width;
},
height: function(height){
if (height !== undefined) {
this.element.height = height;
this.box.style.height = height+"px";
this.triggerResizeListeners();
return this;
}
return this.element.height;
}
}
};
VideoJS.player.extend({
linksSupported: function(){ return true; },
linksInit: function(){
this.showLinksFallback();
this.element = this.video;
},
getLinksFallback: function(){ return this.box.getElementsByTagName("P")[0]; },
hideLinksFallback: function(){
if (this.linksFallback) { this.linksFallback.style.display = "none"; }
},
showLinksFallback: function(){
if (this.linksFallback) { this.linksFallback.style.display = "block"; }
}
});
VideoJS.merge = function(obj1, obj2, safe){
for (var attrname in obj2){
if (obj2.hasOwnProperty(attrname) && (!safe || !obj1.hasOwnProperty(attrname))) { obj1[attrname]=obj2[attrname]; }
}
return obj1;
};
VideoJS.extend = function(obj){ this.merge(this, obj, true); };
VideoJS.extend({
setupAllWhenReady: function(options){
VideoJS.options = options;
VideoJS.DOMReady(VideoJS.setup);
},
DOMReady: function(fn){
VideoJS.addToDOMReady(fn);
},
setup: function(videos, options){
var returnSingular = false,
playerList = [],
videoElement;
if (!videos || videos == "All") {
videos = VideoJS.getVideoJSTags();
} else if (typeof videos != 'object' || videos.nodeType == 1) {
videos = [videos];
returnSingular = true;
}
for (var i=0; i<videos.length; i++) {
if (typeof videos[i] == 'string') {
videoElement = document.getElementById(videos[i]);
} else { // assume DOM object
videoElement = videos[i];
}
playerList.push(new VideoJS(videoElement, options));
}
return (returnSingular) ? playerList[0] : playerList;
},
getVideoJSTags: function() {
var videoTags = document.getElementsByTagName("video"),
videoJSTags = [], videoTag;
for (var i=0,j=videoTags.length; i<j; i++) {
videoTag = videoTags[i];
if (videoTag.className.indexOf("video-js") != -1) {
videoJSTags.push(videoTag);
}
}
return videoJSTags;
},
browserSupportsVideo: function() {
if (typeof VideoJS.videoSupport != "undefined") { return VideoJS.videoSupport; }
VideoJS.videoSupport = !!document.createElement('video').canPlayType;
return VideoJS.videoSupport;
},
getFlashVersion: function(){
if (typeof VideoJS.flashVersion != "undefined") { return VideoJS.flashVersion; }
var version = 0, desc;
if (typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") {
desc = navigator.plugins["Shockwave Flash"].description;
if (desc && !(typeof navigator.mimeTypes != "undefined" && navigator.mimeTypes["application/x-shockwave-flash"] && !navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)) {
version = parseInt(desc.match(/^.*\s+([^\s]+)\.[^\s]+\s+[^\s]+$/)[1], 10);
}
} else if (typeof window.ActiveXObject != "undefined") {
try {
var testObject = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
if (testObject) {
version = parseInt(testObject.GetVariable("$version").match(/^[^\s]+\s(\d+)/)[1], 10);
}
}
catch(e) {}
}
VideoJS.flashVersion = version;
return VideoJS.flashVersion;
},
isIE: function(){ return !+"\v1"; },
isIPad: function(){ return navigator.userAgent.match(/iPad/i) !== null; },
isIPhone: function(){ return navigator.userAgent.match(/iPhone/i) !== null; },
isIOS: function(){ return VideoJS.isIPhone() || VideoJS.isIPad(); },
iOSVersion: function() {
var match = navigator.userAgent.match(/OS (\d+)_/i);
if (match && match[1]) { return match[1]; }
},
isAndroid: function(){ return navigator.userAgent.match(/Android/i) !== null; },
androidVersion: function() {
var match = navigator.userAgent.match(/Android (\d+)\./i);
if (match && match[1]) { return match[1]; }
},
warnings: {
videoNotReady: "Video is not ready yet (try playing the video first).",
localStorageFull: "Local Storage is Full"
}
});
if(VideoJS.isIE()) { document.createElement("video"); }
window.VideoJS = window._V_ = VideoJS;
VideoJS.player.extend({
html5Supported: function(){
if (VideoJS.browserSupportsVideo() && this.canPlaySource()) {
return true;
} else {
return false;
}
},
html5Init: function(){
this.element = this.video;
this.fixPreloading(); // Support old browsers that used autobuffer
this.supportProgressEvents(); // Support browsers that don't use 'buffered'
this.volume((localStorage && localStorage.volume) || this.options.defaultVolume);
if (VideoJS.isIOS()) {
this.options.useBuiltInControls = true;
this.iOSInterface();
} else if (VideoJS.isAndroid()) {
this.options.useBuiltInControls = true;
this.androidInterface();
}
if (!this.options.useBuiltInControls) {
this.video.controls = false;
if (this.options.controlsBelow) { _V_.addClass(this.box, "vjs-controls-below"); }
this.activateElement(this.video, "playToggle");
this.buildStylesCheckDiv(); // Used to check if style are loaded
this.buildAndActivatePoster();
this.buildBigPlayButton();
this.buildAndActivateSpinner();
this.buildAndActivateControlBar();
this.loadInterface(); // Show everything once styles are loaded
this.getSubtitles();
}
},
canPlaySource: function(){
if (this.canPlaySourceResult) { return this.canPlaySourceResult; }
var children = this.video.children;
for (var i=0,j=children.length; i<j; i++) {
if (children[i].tagName.toUpperCase() == "SOURCE") {
var canPlay = this.video.canPlayType(children[i].type) || this.canPlayExt(children[i].src);
if (canPlay == "probably" || canPlay == "maybe") {
this.firstPlayableSource = children[i];
this.canPlaySourceResult = true;
return true;
}
}
}
this.canPlaySourceResult = false;
return false;
},
canPlayExt: function(src){
if (!src) { return ""; }
var match = src.match(/\.([^\.]+)$/);
if (match && match[1]) {
var ext = match[1].toLowerCase();
if (VideoJS.isAndroid()) {
if (ext == "mp4" || ext == "m4v") { return "maybe"; }
} else if (VideoJS.isIOS()) {
if (ext == "m3u8") { return "maybe"; }
}
}
return "";
},
forceTheSource: function(){
this.video.src = this.firstPlayableSource.src; // From canPlaySource()
this.video.load();
},
fixPreloading: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("preload") && this.video.preload != "none") {
this.video.autobuffer = true; // Was a boolean
} else {
this.video.autobuffer = false;
this.video.preload = "none";
}
},
supportProgressEvents: function(e){
_V_.addListener(this.video, 'progress', this.playerOnVideoProgress.context(this));
},
playerOnVideoProgress: function(event){
this.setBufferedFromProgress(event);
},
setBufferedFromProgress: function(event){ // HTML5 Only
if(event.total > 0) {
var newBufferEnd = (event.loaded / event.total) * this.duration();
if (newBufferEnd > this.values.bufferEnd) { this.values.bufferEnd = newBufferEnd; }
}
},
iOSInterface: function(){
if(VideoJS.iOSVersion() < 4) { this.forceTheSource(); } // Fix loading issues
if(VideoJS.isIPad()) { // iPad could work with controlsBelow
this.buildAndActivateSpinner(); // Spinner still works well on iPad, since iPad doesn't have one
}
},
androidInterface: function(){
this.forceTheSource(); // Fix loading issues
_V_.addListener(this.video, "click", function(){ this.play(); }); // Required to play
this.buildBigPlayButton(); // But don't activate the normal way. Pause doesn't work right on android.
_V_.addListener(this.bigPlayButton, "click", function(){ this.play(); }.context(this));
this.positionBox();
this.showBigPlayButtons();
},
loadInterface: function(){
if(!this.stylesHaveLoaded()) {
if (!this.positionRetries) { this.positionRetries = 1; }
if (this.positionRetries++ < 100) {
setTimeout(this.loadInterface.context(this),10);
return;
}
}
this.hideStylesCheckDiv();
this.showPoster();
if (this.video.paused !== false) { this.showBigPlayButtons(); }
if (this.options.controlsAtStart) { this.showControlBars(); }
this.positionAll();
},
buildAndActivateControlBar: function(){
this.controls = _V_.createElement("div", { className: "vjs-controls" });
this.box.appendChild(this.controls);
this.activateElement(this.controls, "controlBar");
this.activateElement(this.controls, "mouseOverVideoReporter");
this.playControl = _V_.createElement("div", { className: "vjs-play-control", innerHTML: "<span></span>" });
this.controls.appendChild(this.playControl);
this.activateElement(this.playControl, "playToggle");
this.progressControl = _V_.createElement("div", { className: "vjs-progress-control" });
this.controls.appendChild(this.progressControl);
this.progressHolder = _V_.createElement("div", { className: "vjs-progress-holder" });
this.progressControl.appendChild(this.progressHolder);
this.activateElement(this.progressHolder, "currentTimeScrubber");
this.loadProgressBar = _V_.createElement("div", { className: "vjs-load-progress" });
this.progressHolder.appendChild(this.loadProgressBar);
this.activateElement(this.loadProgressBar, "loadProgressBar");
this.playProgressBar = _V_.createElement("div", { className: "vjs-play-progress" });
this.progressHolder.appendChild(this.playProgressBar);
this.activateElement(this.playProgressBar, "playProgressBar");
this.timeControl = _V_.createElement("div", { className: "vjs-time-control" });
this.controls.appendChild(this.timeControl);
this.currentTimeDisplay = _V_.createElement("span", { className: "vjs-current-time-display", innerHTML: "00:00" });
this.timeControl.appendChild(this.currentTimeDisplay);
this.activateElement(this.currentTimeDisplay, "currentTimeDisplay");
this.timeSeparator = _V_.createElement("span", { innerHTML: " / " });
this.timeControl.appendChild(this.timeSeparator);
this.durationDisplay = _V_.createElement("span", { className: "vjs-duration-display", innerHTML: "00:00" });
this.timeControl.appendChild(this.durationDisplay);
this.activateElement(this.durationDisplay, "durationDisplay");
this.volumeControl = _V_.createElement("div", {
className: "vjs-volume-control",
innerHTML: "<div><span></span><span></span><span></span><span></span><span></span><span></span></div>"
});
this.controls.appendChild(this.volumeControl);
this.activateElement(this.volumeControl, "volumeScrubber");
this.volumeDisplay = this.volumeControl.children[0];
this.activateElement(this.volumeDisplay, "volumeDisplay");
this.fullscreenControl = _V_.createElement("div", {
className: "vjs-fullscreen-control",
innerHTML: "<div><span></span><span></span><span></span><span></span></div>"
});
this.controls.appendChild(this.fullscreenControl);
this.activateElement(this.fullscreenControl, "fullscreenToggle");
this.hdControl = _V_.createElement("div", {
className: "vjs-hd-control",
innerHTML: "<div>HD</div>"
});
this.controls.appendChild(this.hdControl);
this.activateElement(this.hdControl, "hdToggle");
if (!jQuery('.path_mp4_hd').length) {
jQuery('.vjs-progress-control').css({'left' : '90px', 'right' : '110px'});
jQuery('.vjs-time-control').css({'width' : '75px', 'right' : '35px'});
jQuery('.vjs-hd-control').hide();
}
},
buildAndActivatePoster: function(){
this.updatePosterSource();
if (this.video.poster) {
this.poster = document.createElement("img");
this.box.appendChild(this.poster);
this.poster.src = this.video.poster;
this.poster.className = "vjs-poster";
this.activateElement(this.poster, "poster");
} else {
this.poster = false;
}
},
buildBigPlayButton: function(){
this.bigPlayButton = _V_.createElement("div", {
className: "vjs-big-play-button",
innerHTML: "<span></span>"
});
this.box.appendChild(this.bigPlayButton);
this.activateElement(this.bigPlayButton, "bigPlayButton");
},
buildAndActivateSpinner: function(){
this.spinner = _V_.createElement("div", {
className: "vjs-spinner",
innerHTML: "<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>"
});
this.box.appendChild(this.spinner);
this.activateElement(this.spinner, "spinner");
},
buildStylesCheckDiv: function(){
this.stylesCheckDiv = _V_.createElement("div", { className: "vjs-styles-check" });
this.stylesCheckDiv.style.position = "absolute";
this.box.appendChild(this.stylesCheckDiv);
},
hideStylesCheckDiv: function(){ this.stylesCheckDiv.style.display = "none"; },
stylesHaveLoaded: function(){
if (this.stylesCheckDiv.offsetHeight != 5) {
return false;
} else {
return true;
}
},
positionAll: function(){
this.positionBox();
this.positionControlBars();
this.positionPoster();
},
positionBox: function(){
if (this.videoIsFullScreen) {
this.box.style.width = "";
this.element.style.height="";
if (this.options.controlsBelow) {
this.box.style.height = "";
this.element.style.height = (this.box.offsetHeight - this.controls.offsetHeight) + "px";
}
} else {
this.box.style.width = this.width() + "px";
this.element.style.height=this.height()+"px";
if (this.options.controlsBelow) {
this.element.style.height = "";
}
}
},
getSubtitles: function(){
var tracks = this.video.getElementsByTagName("TRACK");
for (var i=0,j=tracks.length; i<j; i++) {
if (tracks[i].getAttribute("kind") == "subtitles" && tracks[i].getAttribute("src")) {
this.subtitlesSource = tracks[i].getAttribute("src");
this.loadSubtitles();
this.buildSubtitles();
}
}
},
loadSubtitles: function() { _V_.get(this.subtitlesSource, this.parseSubtitles.context(this)); },
parseSubtitles: function(subText) {
var lines = subText.split("\n"),
line = "",
subtitle, time, text;
this.subtitles = [];
this.currentSubtitle = false;
this.lastSubtitleIndex = 0;
for (var i=0; i<lines.length; i++) {
line = _V_.trim(lines[i]); // Trim whitespace and linebreaks
if (line) { // Loop until a line with content
subtitle = {
id: line, // Subtitle Number
index: this.subtitles.length // Position in Array
};
line = _V_.trim(lines[++i]);
time = line.split(" --> ");
subtitle.start = this.parseSubtitleTime(time[0]);
subtitle.end = this.parseSubtitleTime(time[1]);
text = [];
for (var j=i; j<lines.length; j++) { // Loop until a blank line or end of lines
line = _V_.trim(lines[++i]);
if (!line) { break; }
text.push(line);
}
subtitle.text = text.join('<br/>');
this.subtitles.push(subtitle);
}
}
},
parseSubtitleTime: function(timeText) {
var parts = timeText.split(':'),
time = 0;
time += parseFloat(parts[0])*60*60;
time += parseFloat(parts[1])*60;
var seconds = parts[2].split(/\.|,/); // Either . or ,
time += parseFloat(seconds[0]);
ms = parseFloat(seconds[1]);
if (ms) { time += ms/1000; }
return time;
},
buildSubtitles: function(){
this.subtitlesDisplay = _V_.createElement("div", { className: 'vjs-subtitles' });
this.box.appendChild(this.subtitlesDisplay);
this.activateElement(this.subtitlesDisplay, "subtitlesDisplay");
},
addVideoListener: function(type, fn){ _V_.addListener(this.video, type, fn.rEvtContext(this)); },
play: function(){
this.video.play();
return this;
},
onPlay: function(fn){ this.addVideoListener("play", fn); return this; },
pause: function(){
this.video.pause();
return this;
},
onPause: function(fn){ this.addVideoListener("pause", fn); return this; },
paused: function() { return this.video.paused; },
currentTime: function(seconds){
if (seconds !== undefined) {
try { this.video.currentTime = seconds; }
catch(e) { this.warning(VideoJS.warnings.videoNotReady); }
this.values.currentTime = seconds;
return this;
}
return this.video.currentTime;
},
onCurrentTimeUpdate: function(fn){
this.currentTimeListeners.push(fn);
},
duration: function(){
return this.video.duration;
},
buffered: function(){
if (this.values.bufferStart === undefined) {
this.values.bufferStart = 0;
this.values.bufferEnd = 0;
}
if (this.video.buffered && this.video.buffered.length > 0) {
var newEnd = this.video.buffered.end(0);
if (newEnd > this.values.bufferEnd) { this.values.bufferEnd = newEnd; }
}
return [this.values.bufferStart, this.values.bufferEnd];
},
volume: function(percentAsDecimal){
if (percentAsDecimal !== undefined) {
this.values.volume = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
this.video.volume = this.values.volume;
this.setLocalStorage("volume", this.values.volume);
return this;
}
if (this.values.volume) { return this.values.volume; }
return this.video.volume;
},
onVolumeChange: function(fn){ _V_.addListener(this.video, 'volumechange', fn.rEvtContext(this)); },
width: function(width){
if (width !== undefined) {
this.video.width = width; // Not using style so it can be overridden on fullscreen.
this.box.style.width = width+"px";
this.triggerResizeListeners();
return this;
}
return this.video.offsetWidth;
},
height: function(height){
if (height !== undefined) {
this.video.height = height;
this.box.style.height = height+"px";
this.triggerResizeListeners();
return this;
}
return this.video.offsetHeight;
},
supportsFullScreen: function(){
if(typeof this.video.webkitEnterFullScreen == 'function') {
if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) {
return true;
}
}
return false;
},
html5EnterNativeFullScreen: function(){
try {
this.video.webkitEnterFullScreen();
} catch (e) {
if (e.code == 11) { this.warning(VideoJS.warnings.videoNotReady); }
}
return this;
},
enterFullScreen: function(){
if (this.supportsFullScreen()) {
this.html5EnterNativeFullScreen();
} else {
this.enterFullWindow();
}
},
exitFullScreen: function(){
if (this.supportsFullScreen()) {
} else {
this.exitFullWindow();
}
},
enterHd: function(){
videoIsHd = true;
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var mp4_hd=jQuery('.path_mp4_hd').attr('id');
var webm_hd=jQuery('.path_webm_hd').attr('id');
time_video=this.currentTime();
jQuery('.video-js').children('#mp4').attr('src',mp4_hd);
jQuery('.video-js').children('#webm').attr('src',webm_hd);
jQuery('.vjs-hd-control').children().css({'-moz-opacity' : '1', '-khtml-opacity' : '1', 'opacity' : '1'});
if(is_chrome){
this.video.src=webm_hd;
}
this.video.load();
this.video.play();
setTimeout("this.video=document.getElementsByTagName('video')[0];this.video.currentTime = time_video",500);
},
exitHd: function(){
this.videoIsHd = false;
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var mp4=jQuery('.path_mp4').attr('id');
var webm=jQuery('.path_webm').attr('id');
time_video=this.currentTime();
jQuery('.video-js').children('#mp4').attr('src',mp4);
jQuery('.video-js').children('#webm').attr('src',webm);
jQuery('.vjs-hd-control').children().css({'-moz-opacity' : '0.5', '-khtml-opacity' : '0.5', 'opacity' : '0.5'});
if(is_chrome){
this.video.src=webm;
}
this.video.load();
this.video.play();
setTimeout("this.video=document.getElementsByTagName('video')[0];this.video.currentTime = time_video",500);
},
enterFullWindow: function(){
this.videoIsFullScreen = true;
this.docOrigOverflow = document.documentElement.style.overflow;
_V_.addListener(document, "keydown", this.fullscreenOnEscKey.rEvtContext(this));
_V_.addListener(window, "resize", this.fullscreenOnWindowResize.rEvtContext(this));
document.documentElement.style.overflow = 'hidden';
_V_.addClass(this.box, "vjs-fullscreen");
this.positionAll();
},
exitFullWindow: function(){
this.videoIsFullScreen = false;
document.removeEventListener("keydown", this.fullscreenOnEscKey, false);
window.removeEventListener("resize", this.fullscreenOnWindowResize, false);
document.documentElement.style.overflow = this.docOrigOverflow;
_V_.removeClass(this.box, "vjs-fullscreen");
this.positionAll();
},
onError: function(fn){ this.addVideoListener("error", fn); return this; },
onEnded: function(fn){
this.addVideoListener("ended", fn); return this;
}
});
VideoJS.player.newBehavior("player", function(player){
this.onError(this.playerOnVideoError);
this.onPlay(this.playerOnVideoPlay);
this.onPlay(this.trackCurrentTime);
this.onPause(this.playerOnVideoPause);
this.onPause(this.stopTrackingCurrentTime);
this.onEnded(this.playerOnVideoEnded);
this.trackBuffered();
this.onBufferedUpdate(this.isBufferFull);
},{
playerOnVideoError: function(event){
this.log(event);
this.log(this.video.error);
},
playerOnVideoPlay: function(event){ this.hasPlayed = true; },
playerOnVideoPause: function(event){},
playerOnVideoEnded: function(event){
this.currentTime(0);
this.pause();
},
trackBuffered: function(){
this.bufferedInterval = setInterval(this.triggerBufferedListeners.context(this), 500);
},
stopTrackingBuffered: function(){ clearInterval(this.bufferedInterval); },
bufferedListeners: [],
onBufferedUpdate: function(fn){
this.bufferedListeners.push(fn);
},
triggerBufferedListeners: function(){
this.isBufferFull();
this.each(this.bufferedListeners, function(listener){
(listener.context(this))();
});
},
isBufferFull: function(){
if (this.bufferedPercent() == 1) { this.stopTrackingBuffered(); }
},
trackCurrentTime: function(){
if (this.currentTimeInterval) { clearInterval(this.currentTimeInterval); }
this.currentTimeInterval = setInterval(this.triggerCurrentTimeListeners.context(this), 100); // 42 = 24 fps
this.trackingCurrentTime = true;
},
stopTrackingCurrentTime: function(){
clearInterval(this.currentTimeInterval);
this.trackingCurrentTime = false;
},
currentTimeListeners: [],
triggerCurrentTimeListeners: function(late, newTime){ // FF passes milliseconds late as the first argument
this.each(this.currentTimeListeners, function(listener){
(listener.context(this))(newTime || this.currentTime());
});
},
resizeListeners: [],
onResize: function(fn){
this.resizeListeners.push(fn);
},
triggerResizeListeners: function(){
this.each(this.resizeListeners, function(listener){
(listener.context(this))();
});
}
}
);
VideoJS.player.newBehavior("mouseOverVideoReporter", function(element){
_V_.addListener(element, "mousemove", this.mouseOverVideoReporterOnMouseMove.context(this));
_V_.addListener(element, "mouseout", this.mouseOverVideoReporterOnMouseOut.context(this));
},{
mouseOverVideoReporterOnMouseMove: function(){
this.showControlBars();
clearInterval(this.mouseMoveTimeout);
this.mouseMoveTimeout = setTimeout(this.hideControlBars.context(this), 4000);
},
mouseOverVideoReporterOnMouseOut: function(event){
var parent = event.relatedTarget;
while (parent && parent !== this.box) {
parent = parent.parentNode;
}
if (parent !== this.box) {
this.hideControlBars();
}
}
}
);
VideoJS.player.newBehavior("box", function(element){
this.positionBox();
_V_.addClass(element, "vjs-paused");
this.activateElement(element, "mouseOverVideoReporter");
this.onPlay(this.boxOnVideoPlay);
this.onPause(this.boxOnVideoPause);
},{
boxOnVideoPlay: function(){
_V_.removeClass(this.box, "vjs-paused");
_V_.addClass(this.box, "vjs-playing");
},
boxOnVideoPause: function(){
_V_.removeClass(this.box, "vjs-playing");
_V_.addClass(this.box, "vjs-paused");
}
}
);
VideoJS.player.newBehavior("poster", function(element){
this.activateElement(element, "mouseOverVideoReporter");
this.activateElement(element, "playButton");
this.onPlay(this.hidePoster);
this.onEnded(this.showPoster);
this.onResize(this.positionPoster);
},{
showPoster: function(){
if (!this.poster) { return; }
this.poster.style.display = "block";
this.positionPoster();
},
positionPoster: function(){
if (!this.poster || this.poster.style.display == 'none') { return; }
this.poster.style.height = this.height() + "px"; // Need incase controlsBelow
this.poster.style.width = this.width() + "px"; // Could probably do 100% of box
},
hidePoster: function(){
if (!this.poster) { return; }
this.poster.style.display = "none";
},
updatePosterSource: function(){
if (!this.video.poster) {
var images = this.video.getElementsByTagName("img");
if (images.length > 0) { this.video.poster = images[0].src; }
}
}
}
);
VideoJS.player.newBehavior("controlBar", function(element){
if (!this.controlBars) {
this.controlBars = [];
this.onResize(this.positionControlBars);
}
this.controlBars.push(element);
_V_.addListener(element, "mousemove", this.onControlBarsMouseMove.context(this));
_V_.addListener(element, "mouseout", this.onControlBarsMouseOut.context(this));
},{
showControlBars: function(){
if (!this.options.controlsAtStart && !this.hasPlayed) { return; }
this.each(this.controlBars, function(bar){
bar.style.display = "block";
});
},
positionControlBars: function(){
this.updatePlayProgressBars();
this.updateLoadProgressBars();
},
hideControlBars: function(){
if (this.options.controlsHiding && !this.mouseIsOverControls) {
this.each(this.controlBars, function(bar){
bar.style.display = "none";
});
}
},
onControlBarsMouseMove: function(){ this.mouseIsOverControls = true; },
onControlBarsMouseOut: function(event){
this.mouseIsOverControls = false;
}
}
);
VideoJS.player.newBehavior("playToggle", function(element){
if (!this.elements.playToggles) {
this.elements.playToggles = [];
this.onPlay(this.playTogglesOnPlay);
this.onPause(this.playTogglesOnPause);
}
this.elements.playToggles.push(element);
_V_.addListener(element, "click", this.onPlayToggleClick.context(this));
},{
onPlayToggleClick: function(event){
if (this.paused()) {
this.play();
} else {
this.pause();
}
},
playTogglesOnPlay: function(event){
this.each(this.elements.playToggles, function(toggle){
_V_.removeClass(toggle, "vjs-paused");
_V_.addClass(toggle, "vjs-playing");
});
},
playTogglesOnPause: function(event){
this.each(this.elements.playToggles, function(toggle){
_V_.removeClass(toggle, "vjs-playing");
_V_.addClass(toggle, "vjs-paused");
});
}
}
);
VideoJS.player.newBehavior("playButton", function(element){
_V_.addListener(element, "click", this.onPlayButtonClick.context(this));
},{
onPlayButtonClick: function(event){ this.play(); }
}
);
VideoJS.player.newBehavior("pauseButton", function(element){
_V_.addListener(element, "click", this.onPauseButtonClick.context(this));
},{
onPauseButtonClick: function(event){ this.pause(); }
}
);
VideoJS.player.newBehavior("playProgressBar", function(element){
if (!this.playProgressBars) {
this.playProgressBars = [];
this.onCurrentTimeUpdate(this.updatePlayProgressBars);
}
this.playProgressBars.push(element);
},{
updatePlayProgressBars: function(newTime){
var progress = (newTime !== undefined) ? newTime / this.duration() : this.currentTime() / this.duration();
if (isNaN(progress)) { progress = 0; }
this.each(this.playProgressBars, function(bar){
if (bar.style) { bar.style.width = _V_.round(progress * 100, 2) + "%"; }
});
}
}
);
VideoJS.player.newBehavior("loadProgressBar", function(element){
if (!this.loadProgressBars) { this.loadProgressBars = []; }
this.loadProgressBars.push(element);
this.onBufferedUpdate(this.updateLoadProgressBars);
},{
updateLoadProgressBars: function(){
this.each(this.loadProgressBars, function(bar){
if (bar.style) { bar.style.width = _V_.round(this.bufferedPercent() * 100, 2) + "%"; }
});
}
}
);
VideoJS.player.newBehavior("currentTimeDisplay", function(element){
if (!this.currentTimeDisplays) {
this.currentTimeDisplays = [];
this.onCurrentTimeUpdate(this.updateCurrentTimeDisplays);
}
this.currentTimeDisplays.push(element);
},{
updateCurrentTimeDisplays: function(newTime){
if (!this.currentTimeDisplays) { return; }
var time = (newTime) ? newTime : this.currentTime();
this.each(this.currentTimeDisplays, function(dis){
dis.innerHTML = _V_.formatTime(time);
});
}
}
);
VideoJS.player.newBehavior("durationDisplay", function(element){
if (!this.durationDisplays) {
this.durationDisplays = [];
this.onCurrentTimeUpdate(this.updateDurationDisplays);
}
this.durationDisplays.push(element);
},{
updateDurationDisplays: function(){
if (!this.durationDisplays) { return; }
this.each(this.durationDisplays, function(dis){
if (this.duration()) { dis.innerHTML = _V_.formatTime(this.duration()); }
});
}
}
);
VideoJS.player.newBehavior("currentTimeScrubber", function(element){
_V_.addListener(element, "mousedown", this.onCurrentTimeScrubberMouseDown.rEvtContext(this));
},{
onCurrentTimeScrubberMouseDown: function(event, scrubber){
event.preventDefault();
this.currentScrubber = scrubber;
this.stopTrackingCurrentTime(); // Allows for smooth scrubbing
this.videoWasPlaying = !this.paused();
this.pause();
_V_.blockTextSelection();
this.setCurrentTimeWithScrubber(event);
_V_.addListener(document, "mousemove", this.onCurrentTimeScrubberMouseMove.rEvtContext(this));
_V_.addListener(document, "mouseup", this.onCurrentTimeScrubberMouseUp.rEvtContext(this));
},
onCurrentTimeScrubberMouseMove: function(event){ // Removeable
this.setCurrentTimeWithScrubber(event);
},
onCurrentTimeScrubberMouseUp: function(event){ // Removeable
_V_.unblockTextSelection();
document.removeEventListener("mousemove", this.onCurrentTimeScrubberMouseMove, false);
document.removeEventListener("mouseup", this.onCurrentTimeScrubberMouseUp, false);
if (this.videoWasPlaying) {
this.play();
this.trackCurrentTime();
}
},
setCurrentTimeWithScrubber: function(event){
var newProgress = _V_.getRelativePosition(event.pageX, this.currentScrubber);
var newTime = newProgress * this.duration();
this.triggerCurrentTimeListeners(0, newTime); // Allows for smooth scrubbing
if (newTime == this.duration()) { newTime = newTime - 0.1; }
this.currentTime(newTime);
}
}
);
VideoJS.player.newBehavior("volumeDisplay", function(element){
if (!this.volumeDisplays) {
this.volumeDisplays = [];
this.onVolumeChange(this.updateVolumeDisplays);
}
this.volumeDisplays.push(element);
this.updateVolumeDisplay(element); // Set the display to the initial volume
},{
updateVolumeDisplays: function(){
if (!this.volumeDisplays) { return; }
this.each(this.volumeDisplays, function(dis){
this.updateVolumeDisplay(dis);
});
},
updateVolumeDisplay: function(display){
var volNum = Math.ceil(this.volume() * 6);
this.each(display.children, function(child, num){
if (num < volNum) {
_V_.addClass(child, "vjs-volume-level-on");
} else {
_V_.removeClass(child, "vjs-volume-level-on");
}
});
}
}
);
VideoJS.player.newBehavior("volumeScrubber", function(element){
_V_.addListener(element, "mousedown", this.onVolumeScrubberMouseDown.rEvtContext(this));
},{
onVolumeScrubberMouseDown: function(event, scrubber){
_V_.blockTextSelection();
this.currentScrubber = scrubber;
this.setVolumeWithScrubber(event);
_V_.addListener(document, "mousemove", this.onVolumeScrubberMouseMove.rEvtContext(this));
_V_.addListener(document, "mouseup", this.onVolumeScrubberMouseUp.rEvtContext(this));
},
onVolumeScrubberMouseMove: function(event){
this.setVolumeWithScrubber(event);
},
onVolumeScrubberMouseUp: function(event){
this.setVolumeWithScrubber(event);
_V_.unblockTextSelection();
document.removeEventListener("mousemove", this.onVolumeScrubberMouseMove, false);
document.removeEventListener("mouseup", this.onVolumeScrubberMouseUp, false);
},
setVolumeWithScrubber: function(event){
var newVol = _V_.getRelativePosition(event.pageX, this.currentScrubber);
this.volume(newVol);
}
}
);
VideoJS.player.newBehavior("fullscreenToggle", function(element){
_V_.addListener(element, "click", this.onFullscreenToggleClick.context(this));
},{
onFullscreenToggleClick: function(event){
if (!this.videoIsFullScreen) {
this.enterFullScreen();
} else {
this.exitFullScreen();
}
},
fullscreenOnWindowResize: function(event){ // Removeable
this.positionControlBars();
},
fullscreenOnEscKey: function(event){ // Removeable
if (event.keyCode == 27) {
this.exitFullScreen();
}
}
}
);
VideoJS.player.newBehavior("hdToggle", function(element){
_V_.addListener(element, "click", this.onHdToggleClick.context(this));
},{
onHdToggleClick: function(event){
if (!this.videoIsHd) {
this.enterHd();
} else {
this.exitHd();
}
}
}
);
VideoJS.player.newBehavior("bigPlayButton", function(element){
if (!this.elements.bigPlayButtons) {
this.elements.bigPlayButtons = [];
this.onPlay(this.bigPlayButtonsOnPlay);
this.onEnded(this.bigPlayButtonsOnEnded);
}
this.elements.bigPlayButtons.push(element);
this.activateElement(element, "playButton");
},{
bigPlayButtonsOnPlay: function(event){ this.hideBigPlayButtons(); },
bigPlayButtonsOnEnded: function(event){ this.showBigPlayButtons(); },
showBigPlayButtons: function(){
this.each(this.elements.bigPlayButtons, function(element){
element.style.display = "block";
});
},
hideBigPlayButtons: function(){
this.each(this.elements.bigPlayButtons, function(element){
element.style.display = "none";
});
}
}
);
VideoJS.player.newBehavior("spinner", function(element){
if (!this.spinners) {
this.spinners = [];
_V_.addListener(this.video, "loadeddata", this.spinnersOnVideoLoadedData.context(this));
_V_.addListener(this.video, "loadstart", this.spinnersOnVideoLoadStart.context(this));
_V_.addListener(this.video, "seeking", this.spinnersOnVideoSeeking.context(this));
_V_.addListener(this.video, "seeked", this.spinnersOnVideoSeeked.context(this));
_V_.addListener(this.video, "canplay", this.spinnersOnVideoCanPlay.context(this));
_V_.addListener(this.video, "canplaythrough", this.spinnersOnVideoCanPlayThrough.context(this));
_V_.addListener(this.video, "waiting", this.spinnersOnVideoWaiting.context(this));
_V_.addListener(this.video, "stalled", this.spinnersOnVideoStalled.context(this));
_V_.addListener(this.video, "suspend", this.spinnersOnVideoSuspend.context(this));
_V_.addListener(this.video, "playing", this.spinnersOnVideoPlaying.context(this));
_V_.addListener(this.video, "timeupdate", this.spinnersOnVideoTimeUpdate.context(this));
}
this.spinners.push(element);
},{
showSpinners: function(){
this.each(this.spinners, function(spinner){
spinner.style.display = "block";
});
clearInterval(this.spinnerInterval);
this.spinnerInterval = setInterval(this.rotateSpinners.context(this), 100);
},
hideSpinners: function(){
this.each(this.spinners, function(spinner){
spinner.style.display = "none";
});
clearInterval(this.spinnerInterval);
},
spinnersRotated: 0,
rotateSpinners: function(){
this.each(this.spinners, function(spinner){
spinner.style.WebkitTransform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)';
spinner.style.MozTransform =    'scale(0.5) rotate('+this.spinnersRotated+'deg)';
});
if (this.spinnersRotated == 360) { this.spinnersRotated = 0; }
this.spinnersRotated += 45;
},
spinnersOnVideoLoadedData: function(event){ this.hideSpinners(); },
spinnersOnVideoLoadStart: function(event){ this.showSpinners(); },
spinnersOnVideoSeeking: function(event){ },
spinnersOnVideoSeeked: function(event){ },
spinnersOnVideoCanPlay: function(event){ },
spinnersOnVideoCanPlayThrough: function(event){ this.hideSpinners(); },
spinnersOnVideoWaiting: function(event){
this.showSpinners();
},
spinnersOnVideoStalled: function(event){},
spinnersOnVideoSuspend: function(event){},
spinnersOnVideoPlaying: function(event){ this.hideSpinners(); },
spinnersOnVideoTimeUpdate: function(event){
if(this.spinner.style.display == "block") { this.hideSpinners(); }
}
}
);
VideoJS.player.newBehavior("subtitlesDisplay", function(element){
if (!this.subtitleDisplays) {
this.subtitleDisplays = [];
this.onCurrentTimeUpdate(this.subtitleDisplaysOnVideoTimeUpdate);
this.onEnded(function() { this.lastSubtitleIndex = 0; }.context(this));
}
this.subtitleDisplays.push(element);
},{
subtitleDisplaysOnVideoTimeUpdate: function(time){
if (this.subtitles) {
if (!this.currentSubtitle || this.currentSubtitle.start >= time
|| this.currentSubtitle.end < time) {
var newSubIndex = false,
reverse = (this.subtitles[this.lastSubtitleIndex].start > time),
i = this.lastSubtitleIndex - (reverse) ? 1 : 0;
while (true) { // Loop until broken
if (reverse) { // Looping in reverse
if (i < 0 || this.subtitles[i].end < time) { break; }
if (this.subtitles[i].start < time) {
newSubIndex = i;
break;
}
i--;
} else { // Looping forward
if (i >= this.subtitles.length || this.subtitles[i].start > time) { break; }
if (this.subtitles[i].end > time) {
newSubIndex = i;
break;
}
i++;
}
}
if (newSubIndex !== false) {
this.currentSubtitle = this.subtitles[newSubIndex];
this.lastSubtitleIndex = newSubIndex;
this.updateSubtitleDisplays(this.currentSubtitle.text);
} else if (this.currentSubtitle) {
this.currentSubtitle = false;
this.updateSubtitleDisplays("");
}
}
}
},
updateSubtitleDisplays: function(val){
this.each(this.subtitleDisplays, function(disp){
disp.innerHTML = val;
});
}
}
);
VideoJS.extend({
addClass: function(element, classToAdd){
if ((" "+element.className+" ").indexOf(" "+classToAdd+" ") == -1) {
element.className = element.className === "" ? classToAdd : element.className + " " + classToAdd;
}
},
removeClass: function(element, classToRemove){
if (element.className.indexOf(classToRemove) == -1) { return; }
var classNames = element.className.split(/\s+/);
classNames.splice(classNames.lastIndexOf(classToRemove),1);
element.className = classNames.join(" ");
},
createElement: function(tagName, attributes){
return this.merge(document.createElement(tagName), attributes);
},
blockTextSelection: function(){
document.body.focus();
document.onselectstart = function () { return false; };
},
unblockTextSelection: function(){ document.onselectstart = function () { return true; }; },
formatTime: function(secs) {
var seconds = Math.round(secs);
var minutes = Math.floor(seconds / 60);
minutes = (minutes >= 10) ? minutes : "0" + minutes;
seconds = Math.floor(seconds % 60);
seconds = (seconds >= 10) ? seconds : "0" + seconds;
return minutes + ":" + seconds;
},
getRelativePosition: function(x, relativeElement){
return Math.max(0, Math.min(1, (x - this.findPosX(relativeElement)) / relativeElement.offsetWidth));
},
findPosX: function(obj) {
var curleft = obj.offsetLeft;
while(obj = obj.offsetParent) {
curleft += obj.offsetLeft;
}
return curleft;
},
getComputedStyleValue: function(element, style){
return window.getComputedStyle(element, null).getPropertyValue(style);
},
round: function(num, dec) {
if (!dec) { dec = 0; }
return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
},
addListener: function(element, type, handler){
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on"+type, handler);
}
},
removeListener: function(element, type, handler){
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else if (element.attachEvent) {
element.detachEvent("on"+type, handler);
}
},
get: function(url, onSuccess){
if (typeof XMLHttpRequest == "undefined") {
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (f) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (g) {}
throw new Error("This browser does not support XMLHttpRequest.");
};
}
var request = new XMLHttpRequest();
request.open("GET",url);
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
onSuccess(request.responseText);
}
}.context(this);
request.send();
},
trim: function(string){ return string.toString().replace(/^\s+/, "").replace(/\s+$/, ""); },
bindDOMReady: function(){
if (document.readyState === "complete") {
return VideoJS.onDOMReady();
}
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", VideoJS.DOMContentLoaded, false);
window.addEventListener("load", VideoJS.onDOMReady, false);
} else if (document.attachEvent) {
document.attachEvent("onreadystatechange", VideoJS.DOMContentLoaded);
window.attachEvent("onload", VideoJS.onDOMReady);
}
},
DOMContentLoaded: function(){
if (document.addEventListener) {
document.removeEventListener( "DOMContentLoaded", VideoJS.DOMContentLoaded, false);
VideoJS.onDOMReady();
} else if ( document.attachEvent ) {
if ( document.readyState === "complete" ) {
document.detachEvent("onreadystatechange", VideoJS.DOMContentLoaded);
VideoJS.onDOMReady();
}
}
},
DOMReadyList: [],
addToDOMReady: function(fn){
if (VideoJS.DOMIsReady) {
fn.call(document);
} else {
VideoJS.DOMReadyList.push(fn);
}
},
DOMIsReady: false,
onDOMReady: function(){
if (VideoJS.DOMIsReady) { return; }
if (!document.body) { return setTimeout(VideoJS.onDOMReady, 13); }
VideoJS.DOMIsReady = true;
if (VideoJS.DOMReadyList) {
for (var i=0; i<VideoJS.DOMReadyList.length; i++) {
VideoJS.DOMReadyList[i].call(document);
}
VideoJS.DOMReadyList = null;
}
}
});
VideoJS.bindDOMReady();
Function.prototype.context = function(obj){
var method = this,
temp = function(){
return method.apply(obj, arguments);
};
return temp;
};
Function.prototype.evtContext = function(obj){
var method = this,
temp = function(){
var origContext = this;
return method.call(obj, arguments[0], origContext);
};
return temp;
};
Function.prototype.rEvtContext = function(obj, funcParent){
if (this.hasContext === true) { return this; }
if (!funcParent) { funcParent = obj; }
for (var attrname in funcParent) {
if (funcParent[attrname] == this) {
funcParent[attrname] = this.evtContext(obj);
funcParent[attrname].hasContext = true;
return funcParent[attrname];
}
}
return this.evtContext(obj);
};
if (window.jQuery) {
(function($) {
$.fn.VideoJS = function(options) {
this.each(function() {
VideoJS.setup(this, options);
});
return this;
};
$.fn.player = function() {
return this[0].player;
};
})(jQuery);
}
window.VideoJS = window._V_ = VideoJS;
})(window);
function fallback(video) {
while (video.firstChild) {
if (video.firstChild instanceof HTMLSourceElement) {
video.removeChild(video.firstChild);
} else {
video.parentNode.insertBefore(video.firstChild, video);
}
}
video.parentNode.removeChild(video);
};
(function() {
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++)	{
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
},
{ 	string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari",
versionSearch: "Version"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{		// for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ 		// for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.userAgent,
subString: "iPhone",
identity: "iPhone/iPod"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
BrowserDetect.init();
window.$.client = { os : BrowserDetect.OS, browser : BrowserDetect.browser };
})();
var autoplay_attivo=0;
var numeroImmaginiSfilata=0;
var currIndiceimmagine=0;
var intervalloAutoplay=0;
var intervalloPubblicita=0;
var autoplaySfilate=true;
if (js_variables["dm2011_beauty_trends"] != undefined) {
autoplaySfilate=false;
}
function openWindow() {
if (autoplay_attivo)
window.open(js_variables["uriSfilate"],"_self");
}
jQuery(document).ready( function(){
var autoplaytimer = null;
jQuery('#play-button').bind('click', function() {
var image = jQuery(this).children('img').eq(0);
var img_src= image.attr("src");
if (image.attr('alt')=='play' ){
autoplay_attivo=1;
image.attr('src',img_src.replace('autoplay.gif','pausa.gif'));
image.attr('alt','stop');
var time = 5 * 1000;
autoplaytimer = setInterval("openWindow();", time);
} else {
autoplay_attivo=0;
hrefImg = jQuery('#wrap a').attr("href");
jQuery('#wrap a').attr("href", hrefImg.replace("#sfilate","")+"/(autoplay)/0#sfilate");
hrefImg = jQuery(".nextprev-btn a[title=Prev]").attr("href");
if(hrefImg != 'javascript:void(0);') {
jQuery(".nextprev-btn a[title=Prev]").attr("href", hrefImg.replace("#sfilate","")+"/(autoplay)/0#sfilate");
jQuery(".navigate-carousel-2011 a[title=Prev]").attr("href", hrefImg.replace("#sfilate","")+"/(autoplay)/0#sfilate");
}
hrefImg = jQuery(".nextprev-btn a[title=Next]").attr("href");
if(hrefImg != 'javascript:void(0);') {
jQuery(".nextprev-btn a[title=Next]").attr("href", hrefImg.replace("#sfilate","")+"/(autoplay)/0#sfilate");
jQuery(".navigate-carousel-right-2011 a[title=Next]").attr("href", hrefImg.replace("#sfilate","")+"/(autoplay)/0#sfilate");
}
image.attr('src',img_src.replace('pausa.gif','autoplay.gif'));
image.attr('alt','play');
clearInterval(autoplaytimer);
autoplaytimer=null;
}
return false;
});
if (js_variables["flagAutoplay"] == 1) {
jQuery('#play-button').trigger('click');
}
});
function sfilate2011carousel_itemLoadCallback(carousel, state) {
if (carousel.has(carousel.first, carousel.last)) {
return;
}
carousel.lock();
var url = '/ezjscore/call/fashion::thumbCarousel::'+carousel.first+'::'+carousel.last+'::'+js_variables["sfilateIdCarosel"];
jQuery.ajax({
url: url,
success: function(data) {
sfilate2011carousel_itemAddCallback(carousel, carousel.first, carousel.last, data);
}
});
}
function sfilate2011carousel_itemAddCallback(carousel, first, last, data) {
carousel.unlock();
var div = jQuery(data);
div.each(function(i) {
carousel.add(first + i, jQuery(this).html() );
});
}
jQuery(document).ready(function() {
if (jQuery('#sfilate2011carousel').length>0) {
jQuery('#sfilate2011carousel').jcarousel({
itemLoadCallback: sfilate2011carousel_itemLoadCallback,
itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
scroll:5,
size:js_variables["sfilateCountImgCarosel"],
animation: 1000
});
}
});
jQuery(document).ready(function() {
jQuery('#common-cerca-sfilate-collezione').change(function (){
var collezione = jQuery('#common-cerca-sfilate-collezione').val();
var stagione = jQuery('#common-cerca-sfilate-stagione-default').val();
if (collezione != '') {
var url = '/ezjscore/call/fashion::popolaStagioneSearchSfilate::'+collezione+'::'+stagione;
jQuery.ajax({
url: url,
success: function(data) {
jQuery('#common-cerca-sfilate-stagione').html(data);
}
});
url = '/ezjscore/call/fashion::popolaCittaSearchSfilate::'+collezione+'::'+stagione;
jQuery.ajax({
url: url,
success: function(data) {
jQuery('#common-cerca-sfilate-luogo').html(data);
}
});
}
});
jQuery('#common-cerca-sfilate-stagione').change(function (){
var collezione = jQuery('#common-cerca-sfilate-collezione').val();
var stagione = jQuery('#common-cerca-sfilate-stagione').val();
if (stagione != '') {
var url = '/ezjscore/call/fashion::popolaCittaSearchSfilate::'+collezione+'::'+stagione;
jQuery.ajax({
url: url,
success: function(data) {
jQuery('#common-cerca-sfilate-luogo').html(data);
}
});
}
});
jQuery('#common-sfilate-search').click(function (){
var collezione = jQuery('#common-cerca-sfilate-collezione').val();
var stagione = jQuery('#common-cerca-sfilate-stagione').val();
var citta = jQuery('#common-cerca-sfilate-luogo').val();
var link = '/sfilate';
if (collezione != '') {
link += '/' + collezione;
if (stagione != '')  {
link += '/' + stagione;
if (citta != '') {
link += '/' + citta;
}
}
}
jQuery(location).attr('href', link);
});
});
if (window.js_variables && js_variables["dm2011_sfilate"] != undefined) {
jQuery(document).ready(function(){
jQuery(".dm2011-immagine-fumettata").mouseover(function(){
var position = jQuery(this).offset();
var nome=jQuery(".dm2011-nome",jQuery(this).parent()).html();
var stagione=jQuery(".dm2011-stagione",jQuery(this).parent()).html();
jQuery(".dm2011-sfilate-fumetto .dm2011-sfilate-nome").html(nome);
jQuery(".dm2011-sfilate-fumetto .dm2011-sfilate-stagione").html(stagione);
jQuery(".dm2011-sfilate-fumetto").css({"top":position.top-20}).css({"left":position.left+106}).show().css({"z-index":10000});
});
jQuery(".dm2011-immagine-fumettata").mouseleave(function(){
jQuery(".dm2011-sfilate-fumetto").hide();
});
jQuery("#DM-dm2011sfilate-collezione").sexyCombo({
autofill: false,
triggerSelected:true
});
jQuery("#DM-dm2011sfilate-stagione").sexyCombo({
autofill: false,
triggerSelected:true
});
jQuery("#DM-dm2011sfilate-luogo").sexyCombo({
autofill: false,
triggerSelected: true
});
jQuery("#DM-dm2011sfilate-stilista").sexyCombo({
autofill: false,
triggerSelected:true
});
jQuery("#DM-dm2011sfilate-combo-stagioni-bt").sexyCombo({
autofill: false,
triggerSelected:true
});
jQuery("#DM-dm2011sfilate-collezione").change(function() {
valueCat = jQuery(this).siblings("input:hidden").val().split("/");
if (valueCat[4] != js_variables["sfilate2011_bc_0"]) {
window.location.href=jQuery(this).siblings("input:hidden").val();
}
});
jQuery("#DM-dm2011sfilate-stagione").change(function() {
valueCat = jQuery(this).siblings("input:hidden").val().split("/");
if (valueCat[5] != js_variables["sfilate2011_bc_1"]) {
window.location.href=jQuery(this).siblings("input:hidden").val();
}
});
jQuery("#DM-dm2011sfilate-luogo").change(function() {
valueCat = jQuery(this).siblings("input:hidden").val().split("/");
if (valueCat[6] != js_variables["sfilate2011_bc_2"]) {
window.location.href=jQuery(this).siblings("input:hidden").val();
}
});
jQuery("#DM-dm2011sfilate-stilista").change(function() {
valueCat = jQuery(this).siblings("input:hidden").val().split("/");
if (valueCat.length <= 7)
valueCat[7]='tutti';
if (valueCat[7] != js_variables["sfilate2011_bc_3"]) {
window.location.href=jQuery(this).siblings("input:hidden").val();
}
});
mouseOverImmagini();
if (jQuery('#dm2011sfilate-video-piu-recenti-carousel').length>0) {
jQuery('#dm2011sfilate-video-piu-recenti-carousel').jcarousel({
wrap: 'circular',
scroll: 4,
initCallback: mycarousel_initCallback
});
}
if (jQuery('#dm2011sfilate-gallery-uguale-stilista-carousel').length>0) {
jQuery('#dm2011sfilate-gallery-uguale-stilista-carousel').jcarousel({
wrap: 'circular',
scroll: 4,
initCallback: mycarousel_initCallbackNoArrows
});
}
jQuery('#sfilatedm2011carousel').jcarousel({
itemLoadCallback: sfilatedm2011carousel_itemLoadCallback,
itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
scroll:5,
size:js_variables["sfilateCountImgCarosel"],
animation: 1000
});
});
}
function mouseOverImmagini() {
jQuery(".dm2011immagine-stilista").mouseover(function(){
jQuery(this).css("border","3px solid gray");
}).mouseleave(function(){
jQuery(this).css("border","3px solid white");
});
jQuery(".dm2011immagine-stilista-pink").mouseover(function(){
jQuery(this).css("border","3px solid #D809B1");
}).mouseleave(function(){
jQuery(this).css("border","3px solid #EEEEEE");
});
jQuery(".dm2011immagine-stilista-gray").mouseover(function(){
jQuery(this).css("border","3px solid gray");
}).mouseleave(function(){
jQuery(this).css("border","3px solid #EEEEEE");
});
}
function toolTipPiuVista() {
jQuery(".dm2011sfilate-main-ricerca-item-first").mouseover(function(){
var position = jQuery(this).offset();
jQuery(".dm2011-sfilate-ricerca-fumetto .dm2011-sfilate-nome").html("La più vista");
jQuery(".dm2011-sfilate-ricerca-fumetto").css({"top":position.top-450}).css({"left":position.left+106}).show().css({"z-index":10000});
});
jQuery(".dm2011sfilate-main-ricerca-item-first").mouseleave(function(){
jQuery(".dm2011-sfilate-ricerca-fumetto").hide();
});
}
var tipoSfilate=0;
if (js_variables["dm2011_beauty_trends"] != undefined) {
tipoSfilate=1;
}
if (js_variables["dm2011_backstage_dettaglio"] != undefined) {
tipoSfilate=2;
}
if (window.js_variables && ((js_variables["dm2011_sfilate"] != undefined) || (js_variables["dm2011_beauty_trends"] != undefined))) {
jQuery(document).ready(function(){
numeroImmaginiSfilata=js_variables["numeroimmaginiSlideshowDm2011"];
currIndiceimmagine=js_variables["immagineSlideshowDm2011"];
jQuery(".dm2011-event-bloccoimmaginesfilata").each(function(){
var idsfilata=js_variables["sfilateIdSlideshowDm2011"];
jQuery(this).ez("fashion::imageSlideshowDm2011::"+currIndiceimmagine+"::"+idsfilata+"::"+tipoSfilate, {}, null, function() {bindFunzioniImmagineSfilata();});
});
ricaricaMenuImmaginiDestra();
});
}
function cliccaAutoplaySfilate() {
intervalloPubblicita++;
if (intervalloPubblicita==3) {
intervalloPubblicita=0;
}
jQuery(".dm2011-event-immaginesinistra .image").html('<div class="dm2011-immaginesfilata-waiter"><!-- --></div>');
var idsfilata=js_variables["sfilateIdSlideshowDm2011"];
var indiceimmagine=parseInt(currIndiceimmagine)+1;
if (indiceimmagine>=numeroImmaginiSfilata) {
indiceimmagine=0;
}
googleSfilatedm2011(indiceimmagine);
if (intervalloPubblicita==0) {
pubblicitaSfilatedm2011();
}
var currPagina=Math.floor(currIndiceimmagine/8)*8-1;
currIndiceimmagine=indiceimmagine;
jQuery(".dm2011-event-bloccoimmaginesfilata").ez("fashion::imageSlideshowDm2011::"+currIndiceimmagine+"::"+idsfilata+"::"+tipoSfilate, {}, null, function() {bindFunzioniImmagineSfilata();});
if (currIndiceimmagine<currPagina || currIndiceimmagine>=currPagina+8) {
ricaricaMenuImmaginiDestra();
}
}
function ricaricaMenuImmaginiDestra() {
jQuery(".dm2011-event-elencoimmagini").each(function(){
var idsfilata=js_variables["sfilateIdSlideshowDm2011"];
jQuery(this).ez("fashion::smallImagesSlideshowDm2011::"+currIndiceimmagine+"::"+idsfilata+"::"+tipoSfilate, {}, null, function() {
rebindImmaginiSfilata();
});
});
}
function fermaAutoplaySfilatedm2011() {
autoplaySfilate=false;clearInterval(intervalloAutoplay);
}
function avviaAutoplaySfilatedm2011() {
autoplaySfilate=true;clearInterval(intervalloAutoplay);
intervalloAutoplay=setTimeout("cliccaAutoplaySfilate()", 5000);
}
function cambiaImmagineSfilatedm2011(indiceimmagine) {
fermaAutoplaySfilatedm2011();
jQuery(".dm2011-event-immaginesinistra .image").html('<div class="dm2011-immaginesfilata-waiter"><!-- --></div>');
var idsfilata=js_variables["sfilateIdSlideshowDm2011"];
var currPagina=Math.floor(currIndiceimmagine/8)*8;
currIndiceimmagine=indiceimmagine;
pubblicitaSfilatedm2011();
googleSfilatedm2011(currIndiceimmagine);
jQuery(".dm2011-event-bloccoimmaginesfilata").ez("fashion::imageSlideshowDm2011::"+indiceimmagine+"::"+idsfilata+"::"+tipoSfilate, {}, null, function() {bindFunzioniImmagineSfilata();});
if (currIndiceimmagine<currPagina || currIndiceimmagine>=currPagina+8) {
ricaricaMenuImmaginiDestra();
}
}
function rebindImmaginiSfilata() {
jQuery(".dm2011-collezione-immagine-thumb .dm2011immagine-stilista").mouseover(function(){
jQuery(this).css("border","3px solid gray");
}).mouseleave(function(){
jQuery(this).css("border","3px solid white");
});
jQuery(".dm2011-collezione-immagine-thumb .dm2011immagine-stilista-pink").mouseover(function(){
jQuery(this).css("border","3px solid #D809B1");
}).mouseleave(function(){
jQuery(this).css("border","3px solid #EEEEEE");
});
jQuery(".dm2011-collezione-immagine-thumb").unbind();
jQuery(".dm2011-collezione-immagine-thumb").css("cursor","pointer");
jQuery(".dm2011-collezione-immagine-thumb").click(function(){
var indiceimmagine=jQuery(this).attr("id").split("-")[2];
cambiaImmagineSfilatedm2011(indiceimmagine);
return false; // non togliere questo return altrimeti sul click visualizza l'immagine e si rompe lo slideshow!
});
jQuery(".dm2011-collezione-immagine-thumb .dm2011immagine-stilista").css("border","3px solid white");
jQuery("#dm2011-collezione-"+currIndiceimmagine+" .dm2011immagine-stilista").css("border","3px solid gray").unbind();
jQuery(".dm2011-collezione-immagine-thumb .dm2011immagine-stilista-pink").css("border","3px solid #EEEEEE");
jQuery("#dm2011-collezione-"+currIndiceimmagine+" .dm2011immagine-stilista-pink").css("border","3px solid #D809B1").unbind();
jQuery("#dm2011-collezione-"+currIndiceimmagine).unbind().css("cursor","default");
var currPagina=parseInt(currIndiceimmagine/8)+1;
jQuery(".dm2011-sfilate-pagina").unbind().click(function(){
var indiceimmagine=(parseInt(jQuery(this).attr("id").split("-")[2])-1)*8;
cambiaImmagineSfilatedm2011(indiceimmagine);
});
jQuery("#dm2011-pag-"+currPagina).unbind().css("color","#D90AB0").css("cursor","default").css("text-decoration","none");
if (currPagina!=1)  {
jQuery(".dm2011-pagleft a").unbind().click(function(){
var indiceimmagine=(Math.floor(currIndiceimmagine/8)-1)*8;
cambiaImmagineSfilatedm2011(indiceimmagine);
});
} else {
jQuery(".dm2011-pagleft a").css({ "opacity": 0.5 }).unbind().css("cursor","default");
}
var numeroPagine=Math.ceil(numeroImmaginiSfilata/8);
if (currPagina!=numeroPagine)  {
jQuery(".dm2011-pagright a").unbind().click(function(){
var indiceimmagine=(Math.floor(currIndiceimmagine/8)+1)*8;
cambiaImmagineSfilatedm2011(indiceimmagine);
});
} else {
jQuery(".dm2011-pagright a").css({ "opacity": 0.5 }).unbind().css("cursor","default");
}
}
function bindFunzioniImmagineSfilata() {
rebindImmaginiSfilata();
var altezzaimm = jQuery('.dm2011-event-immaginesinistra .image img').innerHeight();
jQuery('.dm2011-event-immaginesinistra').css('height',(altezzaimm+1));
jQuery(".dm2011-event-immaginesinistra .next").click(function(){
var indiceimmagine=parseInt(currIndiceimmagine)+1;
if (indiceimmagine>=numeroImmaginiSfilata) {
indiceimmagine=0;
}
cambiaImmagineSfilatedm2011(indiceimmagine);
});
jQuery(".dm2011-event-immaginesinistra .prev").click(function(){
var indiceimmagine=parseInt(currIndiceimmagine)-1;
if (indiceimmagine<0) {
indiceimmagine=numeroImmaginiSfilata-1;
}
cambiaImmagineSfilatedm2011(indiceimmagine);
});
if (autoplaySfilate) {
avviaAutoplaySfilatedm2011();
settaClickPausa();
} else {
jQuery(".dm2011-event-immaginesinistra .pausa").hide();
settaClickPlay();
}
}
function settaClickPausa() {
jQuery(".dm2011-event-immaginesinistra .pausa").show().click(function(){
fermaAutoplaySfilatedm2011()
jQuery(this).hide();
settaClickPlay();
});
}
function settaClickPlay() {
jQuery(".dm2011-event-immaginesinistra .play").show().click(function(){
avviaAutoplaySfilatedm2011();
jQuery(this).hide();
settaClickPausa();
});
}
if (window.js_variables && js_variables["dm2011_beauty_trends"] != undefined) {
var value = '';
jQuery(document).ready(function(){
jQuery("#DM-dm2011beauty-trends-combo-stagioni").sexyCombo({
autofill: false,
triggerSelected:true
});
});
jQuery("#DM-dm2011beauty-trends-combo-stagioni").change(function() {
value = jQuery("#DM-dm2011beauty-trends-combo-stagioni option:selected").val();
if (value != js_variables["DM-dm2011beauty-trends-combo-stagioni-value"]) {
window.location.href = value;
}
});
}
function sfilatedm2011carousel_itemLoadCallback(carousel, state) {
if (carousel.has(carousel.first, carousel.last)) {
return;
}
carousel.lock();
var url = '/ezjscore/call/fashion::thumbCarouselDm2011::'+carousel.first+'::'+carousel.last+'::'+js_variables["sfilateIdCarosel"];
jQuery.ajax({
url: url,
success: function(data) {
sfilatedm2011carousel_itemAddCallback(carousel, carousel.first, carousel.last, data);
}
});
}
function sfilatedm2011carousel_itemAddCallback(carousel, first, last, data) {
carousel.unlock();
var div = jQuery(data);
div.each(function(i) {
carousel.add(first + i, jQuery(this).html() );
});
}
function googleSfilatedm2011(indiceImmagine) {
var urlAttuale = window.location.href;
urlAttuale=urlAttuale.split("(o)")[0]+"(o)/"+indiceImmagine;
_gaq.push(['_trackPageview'],urlAttuale);
_gaq.push(['b._trackPageview'],urlAttuale);
(new Image(1,1)).src = '//secure-it.imrworldwide.com/cgi-bin/m?rnd=' + (new Date()).getTime() +'&ci=mondadori-it&cg=0&si='+urlAttuale.replace(/\:/gi,'%3A').replace(/\(/gi,'%28').replace(/\)/gi,'%29');
}
function pubblicitaSfilatedm2011() {
jQuery('#imuadv').html("<iframe src ='/storage/adv/adv.php?type=rn_u&key=ame_dn_sfila_home' frameborder='0' scrolling='no' marginwidth='0' marginheight='0' style='overflow:hide;margin:0pxborder:0px' width='300' height='250'>IMU</iframe>");
}
function mycarousel_initCallbackNoArrows(carousel) {
carousel.buttonNext.bind('click', function() {
carousel.startAuto(0);
});
carousel.buttonPrev.bind('click', function() {
carousel.startAuto(0);
});
carousel.clip.hover(function() {
carousel.stopAuto();
}, function() {
carousel.startAuto();
});
var numero=jQuery(".jcarousel-clip ul li").length;
if (numero<6) {
jQuery(".jcarousel-prev").hide();
jQuery(".jcarousel-next").hide();
}
};
function appearDisappear(divImg){
var myDiv=jQuery(divImg).children('a').children('div');
var img=jQuery(divImg).children('a').children('img');
var userAgent = navigator.userAgent.toLowerCase();
jQuery.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
if (jQuery(myDiv).css('display') == 'none')
{
jQuery(img).css({border: "3px solid gray"});
jQuery(myDiv).css({display:"block"});
jQuery(myDiv).css({position:"absolute"});
if(jQuery.browser.version==7 && jQuery.browser.msie)
{
jQuery(myDiv).css('margin-top', '177px');
jQuery(myDiv).css('margin-left', '-140px');
jQuery(myDiv).css('width', '133px');
jQuery(myDiv).css('cursor', 'pointer');
}
else if(jQuery.browser.version==8 && jQuery.browser.msie)
{
jQuery(myDiv).css('margin-top', '-34px');
jQuery(myDiv).css('margin-left', '3px');
}
else if(jQuery.browser.version==9 && jQuery.browser.msie)
{
jQuery(myDiv).css('margin-top', '-32px');
jQuery(myDiv).css('margin-left', '3px');
}
else if(jQuery.browser.chrome)
{
jQuery(myDiv).css('margin-top', '-34px');
jQuery(myDiv).css('margin-left', '3px');
}
else if(jQuery.browser.safari || jQuery.browser.webkit)
{
jQuery(myDiv).css('margin-top', '-34px');
jQuery(myDiv).css('margin-left', '3px');
}
else if(jQuery.browser.mozilla)
{
jQuery(myDiv).css('margin-top', '-32px');
jQuery(myDiv).css('margin-left', '3px');
if(jQuery.browser.version.slice(0,3) == "1.9" )
{
jQuery(myDiv).css('margin-top', '-34px');
}
}
else{
jQuery(myDiv).css('margin-top', '-31px');
jQuery(myDiv).css('margin-left', '3px');
}
}
else
{
jQuery(myDiv).css({display:"none"});
jQuery(img).css({border: "3px solid white"});
}
}

