', true);
if (this.data.hasLike) {
this.likeDiv = window.document.createElement('div');
this.likeDiv.innerHTML = '
';
KCSS.setStyle({
width : '100px',
height : '26px',
overflow : 'hidden'
}, [ this.likeDiv ]);
this.likeDiv.addCSSClass('KFBWallFeedShareButton');
this.widgetTitle.appendChild(this.likeDiv);
this.addLocationListener(KFBWallFeed.likeMe);
}
if (this.data.hasShare) {
var share = new KButton(this, '', 'share-button', KFBWallFeed.shareMe);
share.addCSSClass('KFBWallFeedShareButton');
this.appendTitleChild(share);
}
this.clearBoth(KWidget.TITLE_DIV);
this.list = new KFBWallFeedList(this, this.data.postsPerPage, this.data.hash, this.data.autoRefresh, this.data.maxPostLength);
this.appendChild(this.list);
KPanel.prototype.draw.call(this);
}
KFBWallFeed.likeMe = function(widget, hash) {
if (widget.activated()) {
widget.likeDiv.innerHTML = '
';
}
}
KFBWallFeed.shareMe = function(event) {
var widget = KSystem.getEventWidget(event);
window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(widget.data.url.substr(0, widget.data.url.length - 1) + widget.getHash()) + '&src=sp');
}
KFBWallFeed.minimizeMe = function(event, bar) {
var widget = bar || KSystem.getEventWidget(event).parent;
if (widget.minimized) {
widget.pos = widget.pos - 100;
KSystem.setCookie('wallFeedDisplay', {
display : 'true'
});
}
else {
widget.pos = widget.pos + 100;
KSystem.setCookie('wallFeedDisplay', {
display : 'false'
});
}
KEffects.addEffect(widget, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 500,
lock : {
x : true
},
go : {
y : widget.pos
},
onComplete : function(widget, tween) {
widget.minimized = !widget.minimized;
if (widget.minimized) {
widget.minimizeButton.setStyle({
backgroundPosition : '-190px -157px'
}, KButton.BUTTON_ELEMENT);
widget.minimizeButton.setHelpText('maximizar barra');
}
else {
widget.minimizeButton.setStyle({
backgroundPosition : '-116px -157px'
}, KButton.BUTTON_ELEMENT);
widget.minimizeButton.setHelpText('minimizar barra');
}
}
});
}
KFBWallFeedList.prototype = new KList();
KFBWallFeedList.prototype.constructor = KFBWallFeedList;
function KFBWallFeedList(parent, perPage, hash, autoRefresh, maxPostLength) {
if (parent != null) {
KList.call(this, parent);
this.perPage = perPage;
this.facebookOffset = 0;
this.postData = new Array();
this.paginationDispatchType = KBreadcrumb.DISPATCH_URL;
this.hash = parent.hash + '/list';
this.pageHash = hash;
this.autoRefresh = autoRefresh;
this.maxPostLength = maxPostLength;
if (this.autoRefresh) {
this.setStyle({
display : 'none'
}, KWidget.PAGINATION_DIV);
}
}
}
KFBWallFeedList.prototype.load = function() {
KFBOpenGraph.queryFB(this, {
hash : this.pageHash + '/feed',
noToken : true,
args : {
limit : this.perPage,
offset : this.facebookOffset
}
}, 'onLoad');
}
KFBWallFeedList.prototype.onLoad = function(data) {
if (this.autoRefresh) {
for ( var postNr in data.data) {
var post = data.data[postNr];
if (!this.childWidget(this.hash + '/item/' + post.id)) {
var date = KSystem.parseDate('Y-m-d H:i:s 0000', post.created_time.replace(/T|\+/g, ' '));
var item = new KComment(this, {
urlHashText : this.hash + '/item/' + post.id,
feClass : 'KComment',
type : 'comment',
user : {
photo : [ post.picture || 'https://graph.facebook.com/' + post.from.id + '/picture' ]
},
info : {
titleHTML : '
' + post.from.name + '',
descriptionHTML : '
' + KSystem.formatDate('DD, d/MM \u00e0%s H:i', date) + '' + (post.message ? post.message.replace(/<3/g, '♥').substr(0, this.maxPostLength) + (post.message.length > this.maxPostLength ? ' (...)' : '') + '' : '
') + (post.description ? '
' + post.description.replace(/<3/g, '♥').substr(0, this.maxPostLength) + (post.description.length > this.maxPostLength ? ' (...)' : '') + '' : '
') + '
' + (post.comments ? post.comments.count : 0) + ' comentário(s) • ' + (post.likes ? post.likes.count : 0) + ' like(s)'
}
});
item.hash = this.hash + '/item/' + post.id;
item.setStyle({
opacity : '0'
});
item.onShow = function() {
KComment.prototype.onShow.call(this);
KEffects.addEffect(this, {
f : KEffects.easeOutExpo,
type : 'fade',
duration : 3000,
realAlpha : true,
from : {
alpha : 0
},
go : {
alpha : 1
}
});
};
if (this.activated()) {
var firstChild = this.childAt(0);
var lastChild = this.childAt(this.perPage);
this.removeChild(lastChild);
this.insertBefore(item, '0', firstChild);
item.go();
}
else {
this.appendChild(item);
}
}
}
if (data.data.length == 0) {
KBreadcrumb.dispatchEvent(this.id, {
action : '/no-content'
});
}
if (!this.activated()) {
KList.prototype.draw.call(this);
}
var id = this.id;
KSystem.addTimer(function() {
Kinky.getWidget(id).load();
}, this.autoRefresh);
}
else {
this.facebookOffset += this.perPage;
for ( var postNr in data.data) {
var post = data.data[postNr];
var date = KSystem.parseDate('Y-m-d H:i:s 0000', post.created_time.replace(/T|\+/g, ' '));
this.postData.push({
urlHashText : this.hash + '/item/' + post.id,
feClass : 'KComment',
type : 'comment',
user : {
photo : [ post.picture || 'https://graph.facebook.com/' + post.from.id + '/picture' ]
},
info : {
titleHTML : '
' + post.from.name + '',
descriptionHTML : '
' + KSystem.formatDate('DD, d/MM \u00e0%s H:i', date) + '' + (post.message ? post.message.replace(/<3/g, '♥').substr(0, this.maxPostLength) + (post.message.length > this.maxPostLength ? ' (...)' : '') + '' : '
') + (post.description ? '
' + post.description.replace(/<3/g, '♥').substr(0, this.maxPostLength) + (post.description.length > this.maxPostLength ? ' (...)' : '') + '' : '
') + '
' + (post.comments ? post.comments.count : 0) + ' comentário(s) • ' + (post.likes ? post.likes.count : 0) + ' like(s)'
}
});
}
if (data.data.length == 0) {
KBreadcrumb.dispatchEvent(this.id, {
action : '/no-content'
});
}
KList.prototype.onLoad.call(this, this.postData);
this.postData = new Array();
this.totalCount = null;
}
}
KFBWallFeedList.prototype.onPreviousPage = function() {
KList.prototype.onPreviousPage.call(this);
}
KFBWallFeedList.prototype.onNextPage = function() {
KList.prototype.onNextPage.call(this);
}
BCMicroSite.prototype = new KSite();
BCMicroSite.prototype.constructor = BCMicroSite;
BCMicroSite.activeUser = null;
BCMicroSite.dialogWindow = null;
function BCMicroSite(parent) {
if (parent != null) {
KSite.call(this, parent);
BCMicroSite.productPageHash = null;
this.addCSSClass('BCMicroSite_' + Kinky.BASE_VERSION.replace('/', ''));
this.footer = null;
this.contentHeight = 0;
this.theme = 'none';
this.colors = {};
this.colors.background = '#FFFFFF';
this.colors.menuColor1 = '#000000';
this.colors.menuColor2 = '#000000';
this.colors.subMenuColor1 = '#000000';
this.colors.subMenuColor2 = '#000000';
this.colors.textColor = '#000000';
this.colors.titleColor1 = '#000000';
this.colors.titleColor2 = '#000000';
this.colors.titleColor3 = '#000000';
this.colors.titleColor4 = '#000000';
this.colors.footerMenuColor1 = '#FFFFFF';
this.colors.footerMenuColor2 = '#8B87A4';
this.backgroundSite = new KPanel(this);
this.backgroundSite.addCSSClass('BCMicrositeBackground');
this.backgroundSite.hash = '/backgroundSite';
this.backgroundSite.changeContext('/');
this.appendChild(this.backgroundSite, null, KWidget.BACKGROUND_DIV);
this.backgroundPage = new KPanel(this);
this.backgroundPage.addCSSClass('BCMicrositeBackground');
this.backgroundPage.hash = '/backgroundPage';
this.backgroundPage.changeContext('/');
this.appendChild(this.backgroundPage, null, KWidget.BACKGROUND_DIV);
this.loadTranslations();
BCMicroSite.dialogWindow = new KDialog(this);
BCMicroSite.dialogWindow.addCSSClass('DialogWindow');
BCMicroSite.dialogWindow.buttons = KWidget.CLOSE;
BCMicroSite.dialogWindow.type = KDialog.MODAL | KDialog.CENTERED;
BCMicroSite.dialogWindow.buttonLabel = this.translations.buttonLabel;
BCMicroSite.dialogWindow.params = {};
BCMicroSite.dialogWindow.effects = {
enter : {
f : KEffects.linear,
type : 'move',
duration : 200,
go : {
y : 110
},
lock : {
x : true
},
onStart : function(widget, tween) {
tween.go.y = 200 + (window.pageYOffset ? window.pageYOffset : document.body.scrollTop);
}
},
exit : {
f : KEffects.linear,
type : 'move',
duration : 200,
go : {
y : -this.getHeight()
},
lock : {
x : true
},
onStart : function(widget, tween) {
tween.go.y = -widget.getHeight() - 500;
}
}
};
BCMicroSite.dialogWindow.setStyle({
overflow : 'visible',
clear : 'both'
});
BCMicroSite.dialogWindow.onShow = function() {
BCMicroSite.dialogWindow.okBt.setText(BCMicroSite.dialogWindow.buttonLabel);
BCMicroSite.dialogWindow.okBt.setStyle({
left : (115 - BCMicroSite.dialogWindow.okBt.panel.offsetWidth / 2) + 'px'
});
this.setStyle({
left : (KSystem.getBrowserWidth() / 2) + 'px'
});
KDialog.prototype.onShow.call(this);
};
BCMicroSite.dialogWindow.draw = function() {
if (!this.activated()) {
BCMicroSite.dialogWindow.okBt = new BCKButton(this, BCMicroSite.dialogWindow.buttonLabel, 'closeBt', BCMicroSite.dialogCloseHandler);
this.appendChild(BCMicroSite.dialogWindow.okBt);
BCMicroSite.dialogWindow.okBt.go();
}
KDialog.prototype.draw.call(this);
};
this.addActionListener(BCMicroSite.serverError);
this.addLocationListener(BCMicroSite.analytics);
this.widgets = new Object();
this.breadcrumb = 'Biocol';
this.addWindowResizeListener(BCMicroSite.windowResize);
}
}
BCMicroSite.prototype.onLoad = function(data) {
this.loadSiteMap(data);
this.loadElements(data);
var params = {
contentView : 'Page(page_path)',
contentID : BCMicroSite.homepageContentID
};
this.kinky.get(this, this.childWidget('/homepage').data.feService, params, 'onLoadSocialData');
};
BCMicroSite.prototype.onLoadSocialData = function(data) {
try {
Kinky.GOOGLE_ANALYTICS = data.configuracoesDeMicrosite.config.analytics;
BCMicroSite.twitter = data.configuracoesDeMicrosite.config.twitter;
} catch (e) {
}
this.draw();
};
BCMicroSite.dialogCloseHandler = function(widget) {
if (BCMicroSite.dialogWindow.params.type == 1) {
KBreadcrumb.back();
}
KDialog.close(null, BCMicroSite.dialogWindow);
};
BCMicroSite.prototype.loadSiteMap = function(data, parentPage, level) {
level = level || 1;
this.sitemap = data;
for ( var section in data) {
if (section == 'elements') {
continue;
}
var menuData = {
feClass : data[section].feClass,
args : {
section : section
}
};
var index = KSystem.construct(menuData, this);
if (index) {
this.menu[this.appendChild(index).key] = index;
}
for ( var page in data[section].pages) {
var child = KSystem.construct(data[section].pages[page], this);
if (child == null) {
continue;
}
child.level = level;
child.data.section = section;
child.breadcrumb = child.data.titleText || '';
if (data[section].pages[page].urlHashText == this.homepageURL) {
BCMicroSite.homepageContentID = data[section].pages[page].contentID;
}
if (data[section].pages[page].template == 12) {
BCMicroSite.productPageHash = data[section].pages[page].urlHashText;
}
this.addBackgrounds(child);
if (child instanceof KRedirectPage) {
var redirect = child.getRedirect();
if (/http:/.test(redirect)) {
data[section].pages[page].urlHashText = redirect;
} else {
this.appendChild(child);
}
child.redirectUrlHashText = redirect;
} else {
this.appendChild(child);
}
this.loadPages(data[section].pages[page].pages, child, section, level + 1);
}
if (index) {
index.data = {
pages : data[section].pages
};
}
}
};
BCMicroSite.prototype.loadPages = function(data, parentPage, section, level) {
for ( var page in data) {
var child = KSystem.construct(data[page], this);
if (child) {
child.level = level;
child.data.section = section;
child.breadcrumb = parentPage.breadcrumb + ' - ' + (child.data.titleText || '');
this.addBackgrounds(child);
if (child instanceof KRedirectPage) {
var redirect = child.getRedirect();
if (/http:/.test(redirect)) {
data[page].urlHashText = redirect;
} else {
this.appendChild(child);
}
child.redirectUrlHashText = redirect;
} else {
this.appendChild(child);
}
this.loadPages(data[page].pages, child, section, level + 1);
}
}
};
BCMicroSite.prototype.addBackgrounds = function(child) {
if (child.data.graphicStyle && child.data.graphicStyle.images && child.data.graphicStyle.images.length != 0) {
for ( var image in child.data.graphicStyle.images) {
if (child.data.graphicStyle.images[image].stateCode == 'Background Site') {
var backSite = new KImage(this.backgroundSite, child.data.graphicStyle.images[image].fileInternalPath);
backSite.effects = {
enter : {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : 1000,
go : {
alpha : 1
},
from : {
alpha : 0
}
}
};
backSite.addCSSClass('BCMicrositeBackgroundImage');
backSite.waitForLoad = true;
backSite.onShow = function() {
this.parent.width = this.data.width;
this.setStyle({
width : this.data.width + 'px',
opacity : '0'
});
this.parent.setStyle({
width : this.data.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - this.data.width) / 2) + 'px'
});
KImage.prototype.onShow.call(this);
};
this.backgroundSite.appendChild(backSite, child.hash);
} else if (child.data.graphicStyle.images[image].stateCode == 'Background Pagina') {
var backPage = new KImage(this.backgroundPage, child.data.graphicStyle.images[image].fileInternalPath);
backPage.effects = {
enter : {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : 1000,
go : {
alpha : 1
},
from : {
alpha : 0
}
}
};
backPage.addCSSClass('BCMicrositeBackgroundImage');
backPage.waitForLoad = true;
backPage.onShow = function() {
this.parent.width = this.data.width;
this.setStyle({
width : this.data.width + 'px',
opacity : '0'
});
this.parent.setStyle({
width : this.data.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - this.data.width) / 2) + 'px'
});
KImage.prototype.onShow.call(this);
};
this.backgroundPage.appendChild(backPage, child.hash);
}
}
}
};
BCMicroSite.prototype.draw = function() {
this.colors.background = this.data.graphicStyle.colors.background.background;
this.colors.menuColor1 = this.data.graphicStyle.colors.menuColor1.text;
this.colors.menuColor2 = this.data.graphicStyle.colors.menuColor2.text;
this.colors.subMenuColor1 = this.data.graphicStyle.colors.subMenuColor1.text;
this.colors.subMenuColor2 = this.data.graphicStyle.colors.subMenuColor2.text;
this.colors.textColor = this.data.graphicStyle.colors.textColor.text;
this.colors.titleColor1 = this.data.graphicStyle.colors.titleColor1.text;
this.colors.titleColor2 = this.data.graphicStyle.colors.titleColor2.text;
this.colors.titleColor3 = this.data.graphicStyle.colors.titleColor3.text;
this.colors.titleColor4 = this.data.graphicStyle.colors.titleColor4.text;
this.colors.footerMenuColor1 = this.data.graphicStyle.colors.footerMenuColor1.text;
this.colors.footerMenuColor2 = this.data.graphicStyle.colors.footerMenuColor2.text;
var leftPanel = new BCLeftPanel(this);
this.appendChild(leftPanel);
var productPagesMenu = new BCProductPagesMenu(this);
this.appendChild(productPagesMenu, null, KWidget.CONTENT_DIV);
var contestPagesMenu = new BCContestPagesMenu(this);
this.appendChild(contestPagesMenu, null, KWidget.CONTENT_DIV);
var fbLikeProducts = new KFBLikeMe(this, {
fbPageHash : '/produtos',
siteURL : Kinky.SITE_URL,
lookNFeel : KFBLikeMe.LOOK_N_FEEL.BUTTON_COUNT,
size : {
width : 72,
height : 25
}
});
fbLikeProducts.addCSSClass('BCFbLikeSite');
fbLikeProducts.onChangeURL = function(hash) {
var reg_exp = new RegExp(BCMicroSite.productPageHash);
if (reg_exp.test(hash) && hash.split('/')[2]) {
var splited = hash.split('/');
var hashToShare = '/' + Kinky.DEFAULT_LANG + '/' + splited[1] + '/' + splited[2];
if (hashToShare != this.lastHashToShare) {
KFBLikeMe.prototype.onChangeURL.call(this, hashToShare);
this.onShow();
this.lastHashToShare = hashToShare;
}
} else {
this.onHide();
}
};
fbLikeProducts.onShow = function() {
var reg_exp = new RegExp(BCMicroSite.productPageHash);
if (!reg_exp.test(this.getHash())) {
return;
}
KWidget.prototype.onShow.call(this);
};
this.appendChild(fbLikeProducts);
var fbLikeHomepage = new KFBLikeMe(this, {
fbPageHash : '/' + Kinky.DEFAULT_LANG + '/',
siteURL : Kinky.SITE_URL,
lookNFeel : KFBLikeMe.LOOK_N_FEEL.STANDARD,
size : {
width : 300,
height : 60
}
});
fbLikeHomepage.addCSSClass('BCFbLikeHomepage');
fbLikeHomepage.onChangeURL = function(hash) {
if (/homepage/.test(hash)) {
var hashToShare = '/' + (Kinky.DEFAULT_LANG != 'pt' ? Kinky.DEFAULT_LANG + '/' : '');
KFBLikeMe.prototype.onChangeURL.call(this, hashToShare);
this.onShow();
} else {
this.onHide();
}
};
fbLikeHomepage.onShow = function() {
if (!/homepage/.test(this.getHash())) {
return;
}
KWidget.prototype.onShow.call(this);
};
this.appendChild(fbLikeHomepage);
var transparency = new KPanel(this);
transparency.addCSSClass('Transparency');
this.appendTitleChild(transparency);
var titlePanel = new KPanel(this);
titlePanel.addCSSClass('HeaderElements');
{
titlePanel.hash = '/titlePanel';
titlePanel.setStyle({
overflow : 'visible'
});
this.setStyle({
backgroundColor : this.colors.background
});
if (this.data.graphicStyle && this.data.graphicStyle.images && this.data.graphicStyle.images.length != 0) {
for ( var image in this.data.graphicStyle.images) {
if (this.data.graphicStyle.images[image].stateCode == 'Logo') {
var logoBC = new KLink(titlePanel, '#' + Kinky.HOMEPAGE_URL, this.data.graphicStyle.images[image].fileInternalPath);
logoBC.addCSSClass('BCMicrositeLogo');
titlePanel.appendTitleChild(logoBC);
} else if (this.data.graphicStyle.images[image].stateCode == 'Microsite Theme') {
this.theme = this.data.graphicStyle.images[image].fileInternalPath;
} else if (this.data.graphicStyle.images[image].stateCode == 'Background Site') {
var backSite = new KImage(this.backgroundSite, this.data.graphicStyle.images[image].fileInternalPath);
backSite.addCSSClass('BCMicrositeBackgroundImage');
backSite.waitForLoad = true;
backSite.onShow = function() {
this.parent.width = this.data.width;
this.setStyle({
width : this.data.width + 'px'
});
this.parent.setStyle({
width : this.data.width + 'px',
left : Math.round((KSystem.getBrowserWidth() - this.data.width) / 2) + 'px'
});
KImage.prototype.onShow.call(this);
};
this.backgroundSite.appendChild(backSite);
} else if (this.data.graphicStyle.images[image].stateCode == 'Background Footer') {
this.childWidget('menuFooter').setStyle({
backgroundImage : 'url(' + this.data.graphicStyle.images[image].fileInternalPath + ')'
});
}
}
}
var languagePanel = new BCLangCombo(titlePanel);
languagePanel.addCSSClass('LanguagePanel');
titlePanel.appendChild(languagePanel);
}
this.appendTitleChild(titlePanel);
KSite.prototype.draw.call(this);
titlePanel.appendTitleChild(this.childWidget('menuPrincipal'));
// MENUS
this.footer = this.childWidget('menuFooter').panel;
this.contentContainer.appendChild(this.footer);
this.footerEsquerda = this.childWidget('menuFooterEsquerda').topUL;
this.childWidget('menuFooter').content.appendChild(this.footerEsquerda);
this.appendChild(BCMicroSite.dialogWindow);
BCMicroSite.dialogWindow.setStyle({
backgroundImage : 'url(' + this.theme + ')'
});
this.content.appendChild(KCSS.clearBoth());
this.clearBoth(KWidget.TITLE_DIV);
this.resizeHeight(this, null);
this.resizeWidth(this, null);
};
BCMicroSite.prototype.resizeSite = function(size) {
this.contentHeight = size.height;
this.resizeHeight(this, size.height);
this.resizeWidth(this, size.width);
};
BCMicroSite.windowResize = function(site, size) {
site.resizeHeight(site, size.height);
site.resizeWidth(site, size.width);
};
BCMicroSite.prototype.resizeHeight = function(site, height) {
if (height != null) {
var titleHeight = 250;
site.setStyle({
height : Math.max(KSystem.getBrowserHeight(), this.contentHeight + titleHeight) + 'px'
}, [ KWidget.CONTAINER_DIV, KWidget.CONTENT_DIV ]);
}
KCSS.setStyle({
top : (KSystem.getBrowserHeight() - 37) + 'px'
}, [ site.footer ]);
site.childWidget('/newsletter').setStyle({
top : (KSystem.getBrowserHeight() - 190) + 'px'
});
};
BCMicroSite.prototype.resizeWidth = function(site, width) {
site.setStyle({
width : KSystem.getBrowserWidth() + 'px'
}, KWidget.BACKGROUND_DIV);
site.backgroundPage.setStyle({
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - (site.backgroundPage.width != null ? site.backgroundPage.width : site.backgroundPage.getWidth())) / 2) + 'px'
});
site.backgroundSite.setStyle({
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - (site.backgroundSite.width != null ? site.backgroundSite.width : site.backgroundSite.getWidth())) / 2) + 'px'
});
site.childWidget('/newsletter').setStyle({
left : (KSystem.getBrowserWidth() / 2) + 265 + 'px'
});
};
BCMicroSite.serverError = function(widget, action) {
if (action != '/error') {
return;
}
dump(widget.childWidget(widget.getHash()).error.description, true);
};
BCMicroSite.analytics = function(widget, something) {
if (something == '') {
return;
}
try {
this.pageTracker._trackPageview(widget.getURL().replace(/\/\?|\/@/g, ''));
} catch (err) {
try {
this.pageTracker = _gat._getTracker(Kinky.GOOGLE_ANALYTICS);
this.pageTracker._trackPageview(widget.getURL().replace(/\/\?|\/@/g, ''));
} catch (err2) {
debug(err2);
}
}
};
BCPage.prototype = new KPage();
BCPage.prototype.constructor = BCPage;
function BCPage(parent) {
if (parent != null) {
this.overflow = 'visible';
KPage.call(this, parent);
this.addCSSClass('BCPage');
this.addCSSClass('BCPageBackground', KWidget.BACKGROUND_DIV);
this.addCSSClass('BCPageTitle', KWidget.TITLE_DIV);
this.setStyle({
display : 'none'
});
this.subtitle = null;
this.addResizeListener(BCPage.resize);
this.graphicStyle = null;
this.translations = {};
this.waitForLoad = true;
this.effects = {
enter : {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : BCPage.FADE_DURATION,
go : {
alpha : 1
},
from : {
alpha : 0
}
}
};
}
}
BCPage.prototype.loadTranslations = function() {
};
BCPage.prototype.getTranslation = function(widgetClass) {
if (this.translations[widgetClass]) {
return this.translations[widgetClass];
}
};
BCPage.prototype.onLoad = function(data) {
var siteGraphicStyle = this.parent.data.graphicStyle;
this.graphicStyle = this.data.graphicStyle;
this.graphicStyle.colors.background = siteGraphicStyle.colors.background;
this.graphicStyle.colors.menuColor1 = siteGraphicStyle.colors.menuColor1;
this.graphicStyle.colors.menuColor2 = siteGraphicStyle.colors.menuColor2;
this.graphicStyle.colors.subMenuColor1 = siteGraphicStyle.colors.subMenuColor1;
this.graphicStyle.colors.subMenuColor2 = siteGraphicStyle.colors.subMenuColor2;
this.graphicStyle.colors.textColor = siteGraphicStyle.colors.textColor;
this.graphicStyle.colors.titleColor1 = siteGraphicStyle.colors.titleColor1;
this.graphicStyle.colors.titleColor2 = siteGraphicStyle.colors.titleColor2;
this.graphicStyle.colors.titleColor3 = siteGraphicStyle.colors.titleColor3;
this.graphicStyle.colors.titleColor4 = siteGraphicStyle.colors.titleColor4;
this.graphicStyle.colors.footerMenuColor1 = siteGraphicStyle.colors.footerMenuColor1.text;
this.graphicStyle.colors.footerMenuColor2 = siteGraphicStyle.colors.footerMenuColor2.text;
this.setStyle({
color : Kinky.site.colors.titleColor1
}, KWidget.TITLE_DIV);
this.loadTranslations();
KSystem.merge(this.data, data);
KPage.prototype.onLoad.call(this, data);
};
BCPage.prototype.onShow = function() {
if (this.display) {
return;
}
this.setStyle({
opacity : 0
});
if (KPage.prototype.onShow.call(this)) {
this.changeBackgrounds(this.hash);
}
};
BCPage.prototype.onHide = function() {
if (this.display
&& Kinky.site.childWidget(this.getHash()) instanceof KPageDialog) {
return;
}
if (!KPage.prototype.onHide.call(this)) {
this.setStyle({
opacity : '0'
});
this.prepareBackgrounds(this.getHash());
}
};
BCPage.prototype.changeBackgrounds = function(hash_to_activate) {
var backgroundSite = Kinky.site.childWidget('/backgroundSite');
var backgroundPage = Kinky.site.childWidget('/backgroundPage');
var backSiteOk = false;
var backPageOk = false;
while (!backSiteOk || !backPageOk) {
if (!backSiteOk) {
var bg_site_child = backgroundSite.childWidgets(hash_to_activate);
if (bg_site_child != null) {
for ( var element in bg_site_child) {
bg_site_child = bg_site_child[element];
}
if (backgroundSite.getContext() != hash_to_activate) {
backgroundSite.hideContext();
backgroundSite.changeContext(hash_to_activate);
if (bg_site_child instanceof KImage
&& bg_site_child.data != null) {
backgroundSite.width = bg_site_child.data.width;
}
backgroundSite
.setStyle({
width : backgroundSite.width + 'px',
left : Math
.round((Math.max(960, KSystem
.getBrowserWidth()) - backgroundSite.width) / 2)
+ 'px'
});
backgroundSite.showContext();
}
backSiteOk = true;
}
}
if (!backPageOk) {
var bg_page_child = backgroundPage.childWidgets(hash_to_activate);
if (bg_page_child != null) {
for ( var element in bg_page_child) {
bg_page_child = bg_page_child[element];
}
if (backgroundPage.getContext() != hash_to_activate) {
backgroundPage.hideContext();
backgroundPage.changeContext(hash_to_activate);
if (bg_page_child instanceof KImage
&& bg_page_child.data != null) {
backgroundPage.width = bg_page_child.data.width;
} else if (bg_page_child instanceof BCGallery) {
backgroundPage.width = bg_page_child.getWidth();
}
backgroundPage
.setStyle({
width : backgroundPage.width + 'px',
left : Math
.round((Math.max(960, KSystem
.getBrowserWidth()) - backgroundPage.width) / 2)
+ 'px'
});
backgroundPage.showContext();
}
backPageOk = true;
}
}
if (hash_to_activate == '/' || hash_to_activate == '')
break;
if (!backSiteOk || !backPageOk) {
hash_to_activate = hash_to_activate.substring(0, hash_to_activate
.lastIndexOf('/'));
if (hash_to_activate == '')
hash_to_activate = '/';
}
}
if (!backSiteOk) {
backgroundSite.hideContext();
backgroundSite.changeContext('/hidden');
}
if (!backPageOk) {
backgroundPage.hideContext();
backgroundPage.changeContext('/hidden');
}
};
BCPage.prototype.prepareBackgrounds = function(hash_to_activate) {
var backgroundSite = Kinky.site.childWidget('/backgroundSite');
var backgroundPage = Kinky.site.childWidget('/backgroundPage');
var backSiteOk = false;
var backPageOk = false;
while (!backSiteOk || !backPageOk) {
if (!backSiteOk) {
var bg_site_child = backgroundSite.childWidgets(hash_to_activate);
if (bg_site_child != null) {
for ( var element in bg_site_child) {
bg_site_child = bg_site_child[element];
}
if (backgroundSite.getContext() != hash_to_activate) {
//backgroundSite.hideContext();
}
backSiteOk = true;
}
}
if (!backPageOk) {
var bg_page_child = backgroundPage.childWidgets(hash_to_activate);
if (bg_page_child != null) {
for ( var element in bg_page_child) {
bg_page_child = bg_page_child[element];
}
if (backgroundPage.getContext() != hash_to_activate) {
backgroundPage.hideContext();
}
backPageOk = true;
}
}
if (hash_to_activate == '/' || hash_to_activate == '')
break;
if (!backSiteOk || !backPageOk) {
hash_to_activate = hash_to_activate.substring(0, hash_to_activate
.lastIndexOf('/'));
if (hash_to_activate == '')
hash_to_activate = '/';
}
}
// if (!backSiteOk) {
// backgroundSite.hideContext();
// backgroundSite.changeContext('/hidden');
// }
if (!backPageOk) {
backgroundPage.hideContext();
backgroundPage.changeContext('/hidden');
}
};
BCPage.prototype.draw = function(data) {
this.setStyle({
opacity : '0'
});
KPage.prototype.draw.call(this);
if (this.data.description) {
var subText = window.document.createElement('div');
subText.className = 'PageSubtitle';
subText.innerHTML = this.data.description;
this.childDiv(KWidget.TITLE_DIV).appendChild(subText);
}
this.clearBoth();
};
BCPage.resize = function(page, size) {
Kinky.site.resizeSite(size);
};
BCPage.FADE_DURATION = 1000;
BCProfessionalArea.prototype = new KSite();
BCProfessionalArea.prototype.constructor = BCProfessionalArea;
BCProfessionalArea.activeUser = null;
function BCProfessionalArea(parent) {
if (parent != null) {
KSite.call(this, parent);
this.footer = null;
this.contentHeight = 0;
this.addActionListener(BCSite.serverError);
this.addLocationListener(BCSite.analytics);
this.breadcrumb = 'Biocol';
this.addWindowResizeListener(BCProfessionalArea.windowResize);
}
}
BCProfessionalArea.prototype.loadSiteMap = function(data, parentPage, level) {
level = level || 1;
this.sitemap = data;
for ( var section in data) {
if (section == 'elements') {
continue;
}
var menuData = {
feClass : data[section].feClass,
args : {
section : section
}
};
// var index = KSystem.construct(menuData, this);
// if (index) {
// this.menu[this.appendChild(index).key] = index;
// }
for ( var page in data[section].pages) {
var child = KSystem.construct(data[section].pages[page], this);
if (child == null) {
continue;
}
child.level = level;
child.data.section = section;
child.breadcrumb = child.data.titleText || '';
if (child instanceof KRedirectPage) {
var redirect = child.getRedirect();
if (/http:/.test(redirect)) {
data[section].pages[page].urlHashText = redirect;
} else {
this.appendChild(child);
}
}
else {
this.appendChild(child);
}
this.loadPages(data[section].pages[page].pages, child, section, level + 1);
}
//
// if (index) {
// index.data = {
// pages : data[section].pages
// };
// }
}
}
BCProfessionalArea.prototype.loadPages = function(data, parentPage, section, level) {
for ( var page in data) {
var child = KSystem.construct(data[page], this);
if (child) {
child.level = level;
child.data.section = section;
child.breadcrumb = parentPage.breadcrumb + ' - ' + (child.data.titleText || '');
if (child instanceof KRedirectPage) {
var redirect = child.getRedirect();
if (/http:/.test(redirect)) {
data[page].urlHashText = redirect;
} else {
this.appendChild(child);
}
} else {
this.appendChild(child);
}
this.loadPages(data[page].pages, child, section, level + 1);
}
}
}
BCProfessionalArea.prototype.draw = function() {
KSite.prototype.draw.call(this);
var logo = new KImage(this, '/images/professional_area_logo.png');
this.widgetTitle.appendChild(logo.panel);
logo.go();
this.footer = new KPanel(this);
this.footer.addCSSClass('BCProfessionalAreaFooter');
var footerText = new KText(this.footer);
footerText.setText('Lorem Ipsum');
this.footer.appendChild(footerText);
footerText.go();
this.panel.appendChild(this.footer.panel);
this.content.appendChild(KCSS.clearBoth());
this.clearBoth(KWidget.TITLE_DIV);
this.resizeHeight(this, null);
}
BCProfessionalArea.prototype.resizeSite = function(size) {
this.contentHeight = size.height;
this.resizeHeight(this, size.height);
}
BCProfessionalArea.windowResize = function(site, size) {
site.resizeHeight(site, size.height);
}
BCProfessionalArea.prototype.resizeHeight = function(site, height) {
if(height != null) {
var titleHeight = 80;
var footerHeight = 100;
site.setStyle( {
height : Math.max(KSystem.getBrowserHeight(), height + titleHeight + footerHeight) + 'px'
});
}
}
BCProfessionalArea.serverError = function(widget, action) {
if (action != '/error') {
return;
}
dump(widget.childWidget(widget.getHash()).error.description, true);
}
BCProfessionalArea.analytics = function(widget, something) {
if (something == '') { return; }
try {
this.pageTracker._trackPageview(widget.getURL().replace(/\/\?|\/@/g, ''));
}
catch (err) {
try {
this.pageTracker = _gat._getTracker(Kinky.GOOGLE_ANALYTICS);
this.pageTracker._trackPageview(widget.getURL().replace(/\/\?|\/@/g, ''));
}
catch (err) {
}
}
}
BCProfessionalAreaPage.prototype = new KPage();
BCProfessionalAreaPage.prototype.constructor = BCProfessionalAreaPage;
BCProfessionalAreaPage.prototype.heightFix = 0;
function BCProfessionalAreaPage(parent) {
if (parent != null) {
this.overflow = 'visible';
KPage.call(this, parent);
this.addCSSClass('BCProfessionalAreaPage');
this.setStyle( {
display : 'none'
});
this.subtitle = null;
this.addResizeListener(BCProfessionalAreaPage.resize);
this.translations = {};
this.waitForLoad = true;
this.effects = {
enter : {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : BCProfessionalAreaPage.FADE_DURATION,
go : {
alpha : 1
},
from : {
alpha : 0
}
}
};
}
}
BCProfessionalAreaPage.prototype.loadTranslations = function() {
};
BCProfessionalAreaPage.prototype.getTranslation = function(widgetClass) {
if (this.translations[widgetClass]) {
return this.translations[widgetClass];
}
};
BCProfessionalAreaPage.prototype.onLoad = function(data) {
this.loadTranslations();
KSystem.merge(this.data, data);
KPage.prototype.onLoad.call(this, data);
};
BCProfessionalAreaPage.prototype.onShow = function() {
if (this.display) {
return;
}
this.setStyle({
opacity : 0
});
KPage.prototype.onShow.call(this);
};
BCProfessionalAreaPage.prototype.onHide = function() {
if (this.display && Kinky.site.childWidget(this.getHash()) instanceof KPageDialog) {
return;
}
if (!KPage.prototype.onHide.call(this)) {
this.setStyle({
opacity : '0'
});
}
};
BCProfessionalAreaPage.prototype.draw = function(data) {
this.setStyle({
opacity : '0'
});
KPage.prototype.draw.call(this);
if (this.data.description) {
var subText = window.document.createElement('div');
subText.className = 'PageSubtitle';
subText.innerHTML = this.data.description;
this.childDiv(KWidget.TITLE_DIV).appendChild(subText);
}
this.clearBoth();
};
BCProfessionalAreaPage.resize = function(page, size) {
size.height += page.heightFix;
Kinky.site.resizeSite(size);
};
BCProfessionalAreaPage.FADE_DURATION = 1000;
BCSite.prototype = new KSite();
BCSite.prototype.constructor = BCSite;
BCSite.activeUser = null;
BCSite.dialogWindow = null;
function BCSite(parent) {
if (parent != null) {
KSite.call(this, parent);
BCSite.productPageHash = [];
this.footer = null;
this.contentHeight = 0;
this.theme = 'none';
this.colors = {};
this.colors.background = '#FFFFFF';
this.colors.menuColor1 = '#000000';
this.colors.menuColor2 = '#000000';
this.colors.subMenuColor1 = '#000000';
this.colors.subMenuColor2 = '#000000';
this.colors.textColor = '#3F3F3F';
this.colors.titleColor1 = '#000000';
this.colors.titleColor2 = '#000000';
this.colors.titleColor3 = '#000000';
this.colors.titleColor4 = '#000000';
this.colors.footerMenuColor1 = '#FFFFFF';
this.colors.footerMenuColor2 = '#8B87A4';
this.backgroundSite = new KPanel(this);
this.backgroundSite.addCSSClass('BCSiteBackground');
this.backgroundSite.hash = '/backgroundSite';
this.backgroundSite.changeContext('/');
this.appendChild(this.backgroundSite, null, KWidget.BACKGROUND_DIV);
this.backgroundPage = new KPanel(this);
this.backgroundPage.addCSSClass('BCSiteBackground');
this.backgroundPage.hash = '/backgroundPage';
this.backgroundPage.changeContext('/');
this.appendChild(this.backgroundPage, null, KWidget.BACKGROUND_DIV);
BCSite.mapWindowDialog = new KDialog(this);
BCSite.mapWindowDialog.buttons = KWidget.CLOSE;
BCSite.mapWindowDialog.type = KDialog.MODAL | KDialog.CENTERED;
BCSite.mapWindowDialog.params = {};
BCSite.mapWindowDialog.addCSSClass('BCWebsiteMap');
BCSite.mapWindowDialog.currentPointInfo = null;
BCSite.mapWindowDialog.onShow = function() {
KDialog.prototype.onShow.call(this);
this.setStyle({
left : (KSystem.getBrowserWidth() / 2) - 407 + 'px',
top : '210px'
});
};
BCSite.dialogWindow = new KDialog(this);
BCSite.dialogWindow.addCSSClass('DialogWindow');
BCSite.dialogWindow.buttons = KWidget.CLOSE;
BCSite.dialogWindow.type = KDialog.MODAL | KDialog.CENTERED;
BCSite.dialogWindow.params = {};
BCSite.dialogWindow.effects = {
enter : {
f : KEffects.linear,
type : 'move',
duration : 200,
go : {
y : 110
},
lock : {
x : true
},
onStart : function(widget, tween) {
tween.go.y = 200 + (window.pageYOffset ? window.pageYOffset : document.body.scrollTop);
}
},
exit : {
f : KEffects.linear,
type : 'move',
duration : 200,
go : {
y : -this.getHeight()
},
lock : {
x : true
},
onStart : function(widget, tween) {
tween.go.y = -widget.getHeight() - 500;
}
}
}
BCSite.dialogWindow.setStyle({
overflow : 'visible',
clear : 'both'
});
BCSite.dialogWindow.onShow = function() {
this.setStyle({
left : (KSystem.getBrowserWidth() / 2) + 'px'
});
KDialog.prototype.onShow.call(this);
}
BCSite.dialogWindow.draw = function() {
if (!this.activated()) {
var okBt = new BCKButton(this, 'ok', 'closeBt', BCSite.dialogCloseHandler);
this.appendChild(okBt);
okBt.go();
}
KDialog.prototype.draw.call(this);
}
this.addActionListener(BCSite.serverError);
this.addLocationListener(BCSite.analytics);
this.widgets = new Object();
this.breadcrumb = 'Biocol';
this.addWindowResizeListener(BCSite.windowResize);
var today = new Date();
var hours = today.getHours();
var bkImg = '/images/site/backgrounds/';
if (hours >= 5 && hours < 10) {
bkImg += 'manha.jpg';
} else if (hours >= 10 && hours <= 20) {
bkImg += 'tarde.jpg';
} else {
bkImg += 'noite.jpg';
}
this.setStyle({
backgroundImage : 'url("' + bkImg + '")'
}, KWidget.BACKGROUND_DIV);
}
}
BCSite.dialogCloseHandler = function(widget) {
if (BCSite.dialogWindow.params.type == 1) {
KBreadcrumb.back();
}
KDialog.close(null, BCSite.dialogWindow);
}
BCSite.prototype.loadSiteMap = function(data, parentPage, level) {
level = level || 1;
this.sitemap = data;
for ( var section in data) {
if (section == 'elements') {
continue;
}
var menuData = {
feClass : data[section].feClass,
args : {
section : section
}
};
var index = KSystem.construct(menuData, this);
if (index) {
this.menu[this.appendChild(index).key] = index;
}
for ( var page in data[section].pages) {
var child = KSystem.construct(data[section].pages[page], this);
if (child == null) {
continue;
}
child.level = level;
child.data.section = section;
child.breadcrumb = child.data.titleText || '';
this.addBackgrounds(child);
if (child instanceof KRedirectPage) {
var redirect = child.getRedirect();
if (/http:/.test(redirect)) {
data[section].pages[page].urlHashText = redirect;
} else {
this.appendChild(child);
}
child.redirectUrlHashText = redirect;
} else {
this.appendChild(child);
}
this.loadPages(data[section].pages[page].pages, child, section, level + 1);
}
if (index) {
index.data = {
pages : data[section].pages
};
}
}
}
BCSite.prototype.loadPages = function(data, parentPage, section, level) {
for ( var page in data) {
var child = KSystem.construct(data[page], this);
if (child) {
child.level = level;
child.data.section = section;
child.breadcrumb = parentPage.breadcrumb + ' - ' + (child.data.titleText || '');
this.addBackgrounds(child);
if (data[page].template == 21) {
BCSite.productPageHash.push(data[page].urlHashText);
}
if (child instanceof KRedirectPage) {
var redirect = child.getRedirect();
if (/http:/.test(redirect)) {
data[page].urlHashText = redirect;
} else {
this.appendChild(child);
}
} else {
this.appendChild(child);
}
this.loadPages(data[page].pages, child, section, level + 1);
}
}
}
BCSite.prototype.addBackgrounds = function(child) {
if (child.data.graphicStyle && child.data.graphicStyle.images && child.data.graphicStyle.images.length != 0) {
for ( var image in child.data.graphicStyle.images) {
if (child.data.graphicStyle.images[image].stateCode == 'Background Site') {
var backSite = new KImage(this.backgroundSite, child.data.graphicStyle.images[image].fileInternalPath);
backSite.addCSSClass('BCSiteBackgroundImage');
backSite.waitForLoad = true;
backSite.onShow = function() {
this.parent.width = this.data.width;
this.setStyle({
width : this.data.width + 'px'
});
this.parent.setStyle({
width : this.data.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - this.data.width) / 2) + 'px'
});
KImage.prototype.onShow.call(this);
};
this.backgroundSite.appendChild(backSite, child.hash);
} else if (child.data.graphicStyle.images[image].stateCode == 'Background Pagina') {
var backPage = new KImage(this.backgroundPage, child.data.graphicStyle.images[image].fileInternalPath);
backPage.addCSSClass('BCSiteBackgroundImage');
backPage.waitForLoad = true;
backPage.onShow = function() {
this.parent.width = this.data.width;
this.setStyle({
width : this.data.width + 'px'
});
this.parent.setStyle({
width : this.data.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - this.data.width) / 2) + 'px'
});
KImage.prototype.onShow.call(this);
};
this.backgroundPage.appendChild(backPage, child.hash);
}
}
}
}
BCSite.prototype.draw = function() {
var leftPanel = new BCLeftPanel(this);
this.appendChild(leftPanel);
var rightPanel = new BCWebsiteRightPanel(this);
this.appendChild(rightPanel);
var subPagesMenu = new BCSubPagesMenu(this);
this.appendChild(subPagesMenu, null, KWidget.CONTENT_DIV);
var productSubPagesMenuLevel1 = new BCWebsiteProductSubPagesLevel1(this);
this.appendChild(productSubPagesMenuLevel1, null, KWidget.CONTENT_DIV);
var productSubPagesMenuLevel2 = new BCWebsiteProductSubPagesLevel2(this);
this.appendChild(productSubPagesMenuLevel2, null, KWidget.CONTENT_DIV);
var fbLikeProducts = new KFBLikeMe(this, {
fbPageHash : this.getHash(),
siteURL : Kinky.SITE_URL,
lookNFeel : KFBLikeMe.LOOK_N_FEEL.STANDARD,
size : {
width : 250,
height : 30
}
});
fbLikeProducts.addCSSClass('BCFbLikeSite');
fbLikeProducts.onChangeURL = function(hash) {
var indice = BCSite.indexOf(hash, BCSite.productPageHash);
if (indice) {
var splited = hash.split('/');
var hashToShare = '/' + Kinky.DEFAULT_LANG + '/' + splited[1] + '/' + splited[2] + '/' + splited[3];
if (hashToShare != this.lastHashToShare) {
KFBLikeMe.prototype.onChangeURL.call(this, hashToShare);
this.onShow();
this.lastHashToShare = hashToShare;
}
} else {
this.onHide();
}
};
fbLikeProducts.onShow = function() {
var indice = BCSite.indexOf(KBreadcrumb.getHash(), BCSite.productPageHash);
if (!indice) {
return;
}
KWidget.prototype.onShow.call(this);
};
this.appendChild(fbLikeProducts);
var titlePanel = new KPanel(this);
titlePanel.addCSSClass('HeaderElements');
{
titlePanel.hash = '/titlePanel';
titlePanel.setStyle({
overflow : 'visible'
});
this.setStyle({
backgroundColor : this.colors.background
});
if (this.data.graphicStyle && this.data.graphicStyle.images && this.data.graphicStyle.images.length != 0) {
for ( var image in this.data.graphicStyle.images) {
if (this.data.graphicStyle.images[image].stateCode == 'Logo') {
var logoBC = new KLink(titlePanel, '#' + Kinky.HOMEPAGE_URL, this.data.graphicStyle.images[image].fileInternalPath);
logoBC.addCSSClass('BCSiteLogo');
titlePanel.appendTitleChild(logoBC);
} else if (this.data.graphicStyle.images[image].stateCode == 'Site Theme') {
this.theme = this.data.graphicStyle.images[image].fileInternalPath;
} else if (this.data.graphicStyle.images[image].stateCode == 'Background Site') {
var backSite = new KImage(this.backgroundSite, this.data.graphicStyle.images[image].fileInternalPath);
backSite.addCSSClass('BCSiteBackgroundImage');
backSite.waitForLoad = true;
backSite.onShow = function() {
this.parent.width = this.data.width;
this.setStyle({
width : this.data.width + 'px'
});
this.parent.setStyle({
width : this.data.width + 'px',
left : Math.round((KSystem.getBrowserWidth() - this.data.width) / 2) + 'px'
});
KImage.prototype.onShow.call(this);
};
this.backgroundSite.appendChild(backSite);
} else if (this.data.graphicStyle.images[image].stateCode == 'Background Footer') {
this.childWidget('menuFooter').setStyle({
backgroundImage : 'url(' + this.data.graphicStyle.images[image].fileInternalPath + ')'
});
}
}
}
var searchPanel = new KPanel(titlePanel);
searchPanel.addCSSClass('SearchPanel');
{
var searchInput = new KInput(searchPanel, 'text', 'Pesquisa aqui', 'PesquisaLojas');
searchInput.setStyle({
labelPosition : 'inside'
});
searchInput.onEnterSubmit = false;
searchInput.addEventListener('keypress', function(e) {
if(e.keyCode==13){
var value = searchInput.getValue();
if (!value || value == '') {
return;
}
KBreadcrumb.dispatchURL({
hash : '/resultados-de-pesquisa',
query : '/search/' + value
});
}
});
searchPanel.appendChild(searchInput);
var submitBt = new KButton(searchPanel, '', 'submitBt', function() {
var value = searchInput.getValue();
if (!value || value == '') {
return;
}
KBreadcrumb.dispatchURL({
hash : '/resultados-de-pesquisa',
query : '/search/' + value
});
});
KSystem.addEventListener(window.document.body, 'click', function(e) {
var widget = KSystem.getEventWidget(e);
if(!(widget instanceof BCWebsiteMainMenu)) {
Kinky.site.menu['websiteMenuPrincipal'].hide();
}
});
searchPanel.appendChild(submitBt);
}
titlePanel.appendChild(searchPanel);
this.topMenu = this.childWidget('websiteMenuTopo').panel;
titlePanel.content.appendChild(this.topMenu);
var languagePanel = new BCWebsiteLangPanel(titlePanel);
titlePanel.appendChild(languagePanel);
}
this.appendTitleChild(titlePanel);
KSite.prototype.draw.call(this);
// MENUS
this.appendChild(this.childWidget('websiteMenuPrincipal'), null, KWidget.CONTENT_DIV);
this.childWidget('websiteMenuFooter').content.appendChild(this.childWidget('menuLegal').topUL);
this.footer = this.childWidget('websiteMenuFooter').panel;
this.panel.appendChild(this.footer);
this.appendChild(BCSite.mapWindowDialog);
this.appendChild(BCSite.dialogWindow);
BCSite.dialogWindow.setStyle({
backgroundImage : 'url(' + this.theme + ')'
});
this.content.appendChild(KCSS.clearBoth());
this.clearBoth(KWidget.TITLE_DIV);
this.resizeHeight(this, null);
this.resizeWidth(this, null);
}
BCSite.prototype.resizeSite = function(size) {
this.contentHeight = size.height;
this.resizeHeight(this, size.height);
this.resizeWidth(this, size.width);
}
BCSite.windowResize = function(site, size) {
site.resizeHeight(site, size.height);
site.resizeWidth(site, size.width);
}
BCSite.prototype.resizeHeight = function(site, height) {
if (height != null) {
var titleHeight = 190;
var footerHeight = 336;
site.setStyle({
height : Math.max(KSystem.getBrowserHeight(), height + titleHeight + footerHeight) + 'px'
});
}
}
BCSite.prototype.resizeWidth = function(site, width) {
site.setStyle({
width : KSystem.getBrowserWidth() + 'px'
}, KWidget.BACKGROUND_DIV);
site.backgroundPage.setStyle({
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - (site.backgroundPage.width != null ? site.backgroundPage.width : site.backgroundPage.getWidth())) / 2) + 'px'
});
site.backgroundSite.setStyle({
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - (site.backgroundSite.width != null ? site.backgroundSite.width : site.backgroundSite.getWidth())) / 2) + 'px'
});
}
BCSite.serverError = function(widget, action) {
if (action != '/error') {
return;
}
dump(widget.childWidget(widget.getHash()).error.description, true);
};
BCSite.analytics = function(widget, something) {
if (something == '') {
return;
}
try {
this.pageTracker._trackPageview(widget.getURL().replace(/\/\?|\/@/g, ''));
} catch (err) {
try {
this.pageTracker = _gat._getTracker(Kinky.GOOGLE_ANALYTICS);
this.pageTracker._trackPageview(widget.getURL().replace(/\/\?|\/@/g, ''));
} catch (err2) {
debug(err2);
}
}
};
BCSite.indexOf = function(string, arrayReceived) {
if (!(arrayReceived instanceof Array)) {
var arrayToCheck = JSON.parse(arrayReceived);
} else {
var arrayToCheck = arrayReceived;
}
for ( var index in arrayToCheck) {
if (arrayToCheck[index] == string) {
return index;
}
}
return false;
};
BCWebsitePage.prototype = new KPage();
BCWebsitePage.prototype.constructor = BCWebsitePage;
BCWebsitePage.prototype.heightFix = 0;
function BCWebsitePage(parent) {
if (parent != null) {
this.overflow = 'visible';
KPage.call(this, parent);
this.addCSSClass('BCWebsitePage');
this.addCSSClass('BCWebsitePageBackground', KWidget.BACKGROUND_DIV);
this.addCSSClass('BCWebsitePageTitle', KWidget.TITLE_DIV);
this.setStyle( {
display : 'none'
});
this.subtitle = null;
this.addResizeListener(BCWebsitePage.resize);
this.graphicStyle = null;
this.translations = {};
this.waitForLoad = true;
this.effects = {
enter : {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : BCWebsitePage.FADE_DURATION,
go : {
alpha : 1
},
from : {
alpha : 0
}
}
};
}
}
BCWebsitePage.prototype.loadTranslations = function() {
};
BCWebsitePage.prototype.getTranslation = function(widgetClass) {
if (this.translations[widgetClass]) {
return this.translations[widgetClass];
}
};
BCWebsitePage.prototype.onLoad = function(data) {
var siteGraphicStyle = this.parent.data.graphicStyle;
this.graphicStyle = this.data.graphicStyle;
this.graphicStyle.colors.background = siteGraphicStyle.colors.background;
this.graphicStyle.colors.menuColor1 = siteGraphicStyle.colors.menuColor1;
this.graphicStyle.colors.menuColor2 = siteGraphicStyle.colors.menuColor2;
this.graphicStyle.colors.subMenuColor1 = siteGraphicStyle.colors.subMenuColor1;
this.graphicStyle.colors.subMenuColor2 = siteGraphicStyle.colors.subMenuColor2;
this.graphicStyle.colors.textColor = siteGraphicStyle.colors.textColor;
this.graphicStyle.colors.titleColor1 = siteGraphicStyle.colors.titleColor1;
this.graphicStyle.colors.titleColor2 = siteGraphicStyle.colors.titleColor2;
this.graphicStyle.colors.titleColor3 = siteGraphicStyle.colors.titleColor3;
this.graphicStyle.colors.titleColor4 = siteGraphicStyle.colors.titleColor4;
this.graphicStyle.colors.footerMenuColor1 = siteGraphicStyle.colors.footerMenuColor1.text;
this.graphicStyle.colors.footerMenuColor2 = siteGraphicStyle.colors.footerMenuColor2.text;
this.setStyle({
color: Kinky.site.colors.titleColor1
}, KWidget.TITLE_DIV);
this.loadTranslations();
KSystem.merge(this.data, data);
KPage.prototype.onLoad.call(this, data);
};
BCWebsitePage.prototype.onShow = function() {
if (this.display) {
return;
}
this.setStyle({
opacity : 0
});
if (KPage.prototype.onShow.call(this)) {
this.changeBackgrounds(this.hash);
}
};
BCWebsitePage.prototype.changeBackgrounds = function(hash_to_activate) {
var backgroundSite = Kinky.site.childWidget('/backgroundSite');
var backgroundPage = Kinky.site.childWidget('/backgroundPage');
var backSiteOk = false;
var backPageOk = false;
while(!backSiteOk || !backPageOk) {
if(!backSiteOk) {
var bg_site_child = backgroundSite.childWidgets(hash_to_activate);
if(bg_site_child != null) {
for ( var element in bg_site_child) {
bg_site_child = bg_site_child[element];
}
if(backgroundSite.getContext() != hash_to_activate) {
backgroundSite.hideContext();
backgroundSite.changeContext(hash_to_activate);
if(bg_site_child instanceof KImage && bg_site_child.data != null) {
backgroundSite.width = bg_site_child.data.width;
}
backgroundSite.setStyle({
width : backgroundSite.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - backgroundSite.width) / 2) + 'px'
});
backgroundSite.showContext();
}
backSiteOk = true;
}
}
if(!backPageOk) {
var bg_page_child = backgroundPage.childWidgets(hash_to_activate);
if(bg_page_child != null) {
for ( var element in bg_page_child) {
bg_page_child = bg_page_child[element];
}
if(backgroundPage.getContext() != hash_to_activate) {
backgroundPage.hideContext();
backgroundPage.changeContext(hash_to_activate);
if(bg_page_child instanceof KImage && bg_page_child.data != null) {
backgroundPage.width = bg_page_child.data.width;
} else if(bg_page_child instanceof BCGallery) {
backgroundPage.width = bg_page_child.getWidth();
}
backgroundPage.setStyle({
width : backgroundPage.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - backgroundPage.width) / 2) + 'px'
});
backgroundPage.showContext();
}
backPageOk = true;
}
}
if(hash_to_activate == '/' || hash_to_activate == '')
break;
if(!backSiteOk || !backPageOk) {
hash_to_activate = hash_to_activate.substring(0, hash_to_activate.lastIndexOf('/'));
if(hash_to_activate == '')
hash_to_activate = '/';
}
}
if(!backSiteOk) {
backgroundSite.hideContext();
backgroundSite.changeContext('/hidden');
}
if(!backPageOk) {
backgroundPage.hideContext();
backgroundPage.changeContext('/hidden');
}
};
BCWebsitePage.prototype.prepareBackgrounds = function(hash_to_activate) {
var backgroundSite = Kinky.site.childWidget('/backgroundSite');
var backgroundPage = Kinky.site.childWidget('/backgroundPage');
var backSiteOk = false;
var backPageOk = false;
while (!backSiteOk || !backPageOk) {
if (!backSiteOk) {
var bg_site_child = backgroundSite.childWidgets(hash_to_activate);
if (bg_site_child != null) {
for ( var element in bg_site_child) {
bg_site_child = bg_site_child[element];
}
if (backgroundSite.getContext() != hash_to_activate) {
//backgroundSite.hideContext();
}
backSiteOk = true;
}
}
if (!backPageOk) {
var bg_page_child = backgroundPage.childWidgets(hash_to_activate);
if (bg_page_child != null) {
for ( var element in bg_page_child) {
bg_page_child = bg_page_child[element];
}
if (backgroundPage.getContext() != hash_to_activate) {
backgroundPage.hideContext();
}
backPageOk = true;
}
}
if (hash_to_activate == '/' || hash_to_activate == '')
break;
if (!backSiteOk || !backPageOk) {
hash_to_activate = hash_to_activate.substring(0, hash_to_activate
.lastIndexOf('/'));
if (hash_to_activate == '')
hash_to_activate = '/';
}
}
// if (!backSiteOk) {
// backgroundSite.hideContext();
// backgroundSite.changeContext('/hidden');
// }
if (!backPageOk) {
backgroundPage.hideContext();
backgroundPage.changeContext('/hidden');
}
};
BCWebsitePage.prototype.onHide = function() {
if (this.display && Kinky.site.childWidget(this.getHash()) instanceof KPageDialog) {
return;
}
if (!KPage.prototype.onHide.call(this)) {
this.setStyle({
opacity : '0'
});
this.prepareBackgrounds(this.getHash());
}
};
BCWebsitePage.prototype.draw = function(data) {
this.setStyle({
opacity : '0'
});
KPage.prototype.draw.call(this);
if(this.getHash().split('/').length <= 2){
this.setStyle({
display : 'none'
}, KWidget.TITLE_DIV);
}
this.clearBoth();
};
BCWebsitePage.resize = function(page, size) {
size.height += page.heightFix;
Kinky.site.resizeSite(size);
};
BCWebsitePage.FADE_DURATION = 1000;
BCOneColumnNoTitle.prototype = new BCPage();
BCOneColumnNoTitle.prototype.constructor = BCOneColumnNoTitle;
function BCOneColumnNoTitle(parent) {
if (parent != null) {
BCPage.call(this, parent);
this.addCSSClass('BCOneColumnNoTitle');
}
}
BCOneColumnNoTitle.prototype.draw = function() {
BCPage.prototype.draw.call(this);
}
BCOneColumnTitle.prototype = new BCPage();
BCOneColumnTitle.prototype.constructor = BCOneColumnTitle;
function BCOneColumnTitle(parent) {
if (parent != null) {
BCPage.call(this, parent);
}
}
BCOneColumnTitle.prototype.draw = function() {
BCPage.prototype.draw.call(this);
}
BCTwoColumnTitle.prototype = new BCPage();
BCTwoColumnTitle.prototype.constructor = BCTwoColumnTitle;
function BCTwoColumnTitle(parent) {
if (parent != null) {
BCPage.call(this, parent);
this.addCSSClass('BCTwoColumnTitle');
}
}
BCTwoColumnTitle.prototype.draw = function() {
BCPage.prototype.draw.call(this);
}
BCWebsiteThreeColumnHighlight.prototype = new BCWebsitePage();
BCWebsiteThreeColumnHighlight.prototype.constructor = BCWebsiteThreeColumnHighlight;
function BCWebsiteThreeColumnHighlight(parent) {
if (parent != null) {
BCWebsitePage.call(this, parent);
this.addCSSClass('BCWebsiteThreeColumnHighlight');
}
}
BCWebsiteThreeColumnHighlight.prototype.draw = function() {
BCWebsitePage.prototype.draw.call(this);
}
BCWebsiteTwoColumnHighlight.prototype = new BCWebsitePage();
BCWebsiteTwoColumnHighlight.prototype.constructor = BCWebsiteTwoColumnHighlight;
function BCWebsiteTwoColumnHighlight(parent) {
if (parent != null) {
BCWebsitePage.call(this, parent);
this.addCSSClass('BCWebsiteTwoColumnHighlight');
}
}
BCWebsiteTwoColumnHighlight.prototype.draw = function() {
BCWebsitePage.prototype.draw.call(this);
}
BCWebsiteTwoColumnNoHighlight.prototype = new BCWebsitePage();
BCWebsiteTwoColumnNoHighlight.prototype.constructor = BCWebsiteTwoColumnNoHighlight;
BCWebsiteTwoColumnNoHighlight.prototype.heightFix = 120;
function BCWebsiteTwoColumnNoHighlight(parent) {
if (parent != null) {
BCWebsitePage.call(this, parent);
this.addCSSClass('BCWebsiteTwoColumnNoHighlight');
}
}
BCWebsiteTwoColumnNoHighlight.prototype.draw = function() {
var topDiv = window.document.createElement('div');
topDiv.className = 'TopDiv';
this.panel.appendChild(topDiv);
KCSS.addCSSClass('BCWebsitePageContent', this.content);
var bottomDiv = window.document.createElement('div');
bottomDiv.className = 'BottomDiv';
this.contentContainer.appendChild(bottomDiv);
BCWebsitePage.prototype.draw.call(this);
}
BCContestDetail.prototype = new BCOneColumnTitle();
BCContestDetail.prototype.constructor = BCContestDetail;
function BCContestDetail(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
BCContestDetail.participatePage = null;
}
}
BCContestDetail.prototype.draw = function() {
for (var index in Kinky.site.childWidget('menuPrincipal').data.pages){
//o melhor sera criar um template para a pagina passatempo para o caso de haver outro 7 (internal redirect generico) no menu
if (Kinky.site.childWidget('menuPrincipal').data.pages[index].template == 7){
var parentPageChilds = Kinky.site.childWidget('menuPrincipal').data.pages[index].pages;
for (var idx in parentPageChilds){
if (parentPageChilds[idx].template == 19){
BCContestDetail.participatePage = parentPageChilds[idx].urlHashText;
}
}
}
}
this.translations = this.getTranslation(this.className);
var participateBt = new BCKButton(this, this.translations.participate, 'participateBt', function(){
KBreadcrumb.dispatchURL({
hash : BCContestDetail.participatePage
});
});
this.appendChild(participateBt);
BCOneColumnTitle.prototype.draw.call(this);
if (this.childWidget('/richtext').content.getElementsByTagName('h2') && this.childWidget('/richtext').content.getElementsByTagName('h2')[0]){
this.childWidget('/richtext').content.getElementsByTagName('h2')[0].style.color = Kinky.site.colors.titleColor1;
}
};
BCHomepage.prototype = new BCOneColumnNoTitle();
BCHomepage.prototype.constructor = BCHomepage;
BCHomepage.rollOverTimer = null;
BCHomepage.direction = 1;
BCHomepage.Time = 6000;
BCHomepage.counter = null;
function BCHomepage(parent) {
if (parent != null) {
BCOneColumnNoTitle.call(this, parent);
this.addCSSClass('BCOneColumnNoTitle');
}
}
BCHomepage.prototype.draw = function() {
BCOneColumnNoTitle.prototype.draw.call(this);
var backSite = new BCGallery(this);
backSite.data = this.data.imagensRotativas;
Kinky.site.childWidget('/backgroundPage').appendChild(backSite, this.hash);
backSite.draw();
this.panel.appendChild(backSite.pagination);
var clickArea = window.document.createElement('div');
clickArea.className = ' BCHomepageClickArea ';
clickArea.innerHTML = ' ';
KSystem.addEventListener(clickArea, 'click', function(event) {
if (backSite.data.highlightItems[backSite.nPage] && backSite.data.highlightItems[backSite.nPage].url) {
var url = backSite.data.highlightItems[backSite.nPage].url;
if (url.indexOf('http://') == 0) {
window.open(url, '_blank');
}
else {
KBreadcrumb.dispatchURL({
url : url
});
}
}
});
this.panel.appendChild(clickArea);
this.prevButton = window.document.createElement('button');
this.prevButton.setAttribute("type", "button");
this.prevButton.className = ' KWidgetPanelPaginationPrev ';
this.prevButton.innerHTML = ' ';
this.prevButton.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
this.prevButton.style.backgroundRepeat = 'no-repeat';
KSystem.addEventListener(this.prevButton, 'click', function(event) {
clearTimeout(BCHomepage.rollOverTimer);
KWidget.dispatchPrevious(null, backSite);
if (backSite.totalCount > 1) {
BCHomepage.rollOverTimer = setTimeout(BCHomepage.doAutoNext, BCHomepage.Time * 2);
}
});
KSystem.addEventListener(this.prevButton, 'mouseover', function(event) {
var widget = KSystem.getEventTarget(event);
KEffects.addEffect(widget, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 400,
gravity : {
x : 'left'
},
go : {
x : 0
},
lock : {
y : true
}
});
});
KSystem.addEventListener(this.prevButton, 'mouseout', function(event) {
var widget = KSystem.getEventTarget(event);
KEffects.addEffect(widget, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 400,
gravity : {
x : 'left'
},
go : {
x : 5
},
lock : {
y : true
}
});
});
this.panel.appendChild(this.prevButton);
this.nextButton = window.document.createElement('button');
this.nextButton.setAttribute("type", "button");
this.nextButton.className = ' KWidgetPanelPaginationNext ';
this.nextButton.innerHTML = ' ';
this.nextButton.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
this.nextButton.style.backgroundRepeat = 'no-repeat';
KSystem.addEventListener(this.nextButton, 'click', function(event) {
clearTimeout(BCHomepage.rollOverTimer);
KWidget.dispatchNext(null, backSite);
if (backSite.totalCount > 1) {
BCHomepage.rollOverTimer = setTimeout(BCHomepage.doAutoNext, BCHomepage.Time * 2);
}
});
KSystem.addEventListener(this.nextButton, 'mouseover', function(event) {
var widget = KSystem.getEventTarget(event);
KEffects.addEffect(widget, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 400,
gravity : {
x : 'right'
},
go : {
x : -5
},
lock : {
y : true
}
});
});
KSystem.addEventListener(this.nextButton, 'mouseout', function(event) {
var widget = KSystem.getEventTarget(event);
KEffects.addEffect(widget, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 400,
gravity : {
x : 'right'
},
go : {
x : 0
},
lock : {
y : true
}
});
});
this.panel.appendChild(this.nextButton);
backSite.pagination.style.width = (backSite.totalCount * 20) + 'px';
clearTimeout(BCHomepage.rollOverTimer);
if (backSite.totalCount > 1) {
this.prevButton.style.display = 'block';
this.nextButton.style.display = 'block';
BCHomepage.rollOverTimer = setTimeout(BCHomepage.doAutoNext, BCHomepage.Time);
}
else {
this.prevButton.style.display = 'none';
this.nextButton.style.display = 'none';
}
};
BCHomepage.prototype.onShow = function() {
BCPage.prototype.onShow.call(this);
clearTimeout(BCHomepage.rollOverTimer);
var backSite = Kinky.site.childWidget('/backgroundPage').childWidget('/rotation-gallery');
if (backSite != null) {
if (backSite.totalCount > 1) {
this.prevButton.style.display = 'block';
this.nextButton.style.display = 'block';
BCHomepage.rollOverTimer = setTimeout(BCHomepage.doAutoNext, BCHomepage.Time);
}
else {
this.prevButton.style.display = 'none';
this.nextButton.style.display = 'none';
}
}
};
BCHomepage.prototype.onHide = function() {
clearTimeout(BCHomepage.rollOverTimer);
BCPage.prototype.onHide.call(this);
};
BCHomepage.doAutoNext = function() {
clearTimeout(BCHomepage.rollOverTimer);
var backSite = Kinky.site.childWidget('/backgroundPage').childWidget('/rotation-gallery');
KWidget.dispatchNext(null, backSite);
if (backSite.totalCount > 1) {
BCHomepage.rollOverTimer = setTimeout(BCHomepage.doAutoNext, BCHomepage.Time);
}
};
BCHomepage.prototype.changeBackgrounds = function(hash_to_activate) {
var backgroundSite = Kinky.site.childWidget('/backgroundSite');
var backgroundPage = Kinky.site.childWidget('/backgroundPage');
var backSiteOk = false;
while (!backSiteOk) {
var bg_site_child = backgroundSite.childWidgets(hash_to_activate);
if (bg_site_child != null) {
for ( var element in bg_site_child) {
bg_site_child = bg_site_child[element];
}
if (backgroundSite.getContext() != hash_to_activate) {
backgroundSite.hideContext();
backgroundSite.changeContext(hash_to_activate);
if (bg_site_child instanceof KImage && (bg_site_child.data != null)) {
backgroundSite.width = bg_site_child.data.width;
}
backgroundSite.setStyle({
width : backgroundSite.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - backgroundSite.width) / 2) + 'px'
});
backgroundSite.showContext();
}
backSiteOk = true;
}
if ((hash_to_activate == '/') || (hash_to_activate == '')) {
break;
}
if (!backSiteOk) {
hash_to_activate = hash_to_activate.substring(0, hash_to_activate.lastIndexOf('/'));
if (hash_to_activate == '') {
hash_to_activate = '/';
}
}
}
if (!backSiteOk) {
backgroundSite.hideContext();
backgroundSite.changeContext('/hidden');
}
backgroundPage.hideContext();
backgroundPage.changeContext(this.hash);
var backSite = Kinky.site.childWidget('/backgroundPage').childWidget('/rotation-gallery');
if (backSite != null) {
backgroundPage.width = backSite.width;
}
backgroundPage.setStyle({
width : backgroundPage.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - backgroundPage.width) / 2) + 'px'
});
backgroundPage.showContext();
};
BCLocationMap.prototype = new BCOneColumnTitle();
BCLocationMap.prototype.constructor = BCLocationMap;
function BCLocationMap(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
this.waitForLoad = false;
}
}
BCLocationMap.prototype.draw = function() {
var topDiv = window.document.createElement('div');
topDiv.className = 'BorderTop';
this.content.appendChild(topDiv);
var botDiv = window.document.createElement('div');
botDiv.className = 'BorderBot';
this.contentContainer.appendChild(botDiv);
BCOneColumnTitle.prototype.draw.call(this);
};
BCNewsletter.prototype = new KPageDialog();
BCNewsletter.prototype.constructor = BCNewsletter;
function BCNewsletter(parent) {
if (parent) {
KPageDialog.call(this, parent);
this.addCSSClass('BCNewsletter');
this.newsletterForm = new KForm(this);
this.newsletterForm.staticForm = true;
this.newsletterForm.action = 'php:Entity:SubscribeNewsletter';
this.setStyle({
position : 'fixed'
});
BCNewsletter.newsletterCategory = null;
this.translations = null;
}
}
BCNewsletter.prototype.onLoad = function(data) {
KSystem.merge(this.data, data);
KPage.prototype.onLoad.call(this, this.data);
};
BCNewsletter.prototype.onShow = function() {
KPageDialog.prototype.onShow.call(this);
this.setStyle({
left : (KSystem.getBrowserWidth() / 2) + 265 + 'px',
top : (KSystem.getBrowserHeight() - 190) + 'px'
});
this.newsletterForm.reset();
};
BCNewsletter.prototype.draw = function() {
this.loadTranslations();
this.setStyle({
backgroundImage : 'url("' + Kinky.site.theme + '")',
backgroudRepeat : 'no-repeat'
});
BCNewsletter.newsletterCategory = this.data.categoriaDeNewsletter.config.contentID;
var subscriberName = new KInput(this.newsletterForm, 'text', this.translations.name, 'entityName');
subscriberName.addCSSClass('NewsletterInput');
subscriberName.addValidator(/.+/, 'campo de preenchimento obrigat\u00f3rio');
subscriberName.setStyle({
labelPosition : 'inside'
});
this.newsletterForm.addInput(subscriberName);
var subscriberEmail = new KInput(this.newsletterForm, 'text', this.translations.email, 'entityEmail');
subscriberEmail.addCSSClass('NewsletterInput');
subscriberEmail.addValidator(/(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/, 'campo de preenchimento obrigat\u00f3rio');
subscriberEmail.setStyle({
labelPosition : 'inside'
});
this.newsletterForm.addInput(subscriberEmail);
this.newsletterForm.clearBoth();
var checkBiocol = new KCheckBox(this.newsletterForm, '', 'biocolNewsletter', true);
checkBiocol.addOption(1, this.translations.biocol, true);
this.newsletterForm.addInput(checkBiocol);
var submitButton = new BCButton(this.newsletterForm, this.translations.submit, 'submit');
this.newsletterForm.appendChild(submitButton);
this.newsletterForm.onValidate = function(data, params, status) {
if (status) {
params.newsletterCategory = [ BCNewsletter.newsletterCategory ];
return params;
} else {
var first = true;
for ( var index in params) {
var input = params[index].getInput();
if (first) {
first = false;
input.focus();
}
input.style.color = 'red';
}
}
};
this.newsletterForm.onSuccess = function(data) {
BCMicroSite.dialogWindow.params.type = 1;
BCMicroSite.dialogWindow.buttonLabel = (data.errorCode == 1 ? this.parent.translations.successButton : this.parent.translations.errorButton);
KDialog.show(BCMicroSite.dialogWindow, {
content : (data.errorCode == 1 ? this.parent.translations.successText : this.parent.translations.errorText),
title : (data.errorCode == 1 ? this.parent.translations.successTitle : this.parent.translations.errorTitle)
});
if (data.errorCode != 1) {
BCMicroSite.dialogWindow.widgetTitle.childNodes[0].style.color = 'red';
}
};
this.newsletterForm.reset = function() {
for ( var element in this.inputByID) {
if (this.inputByID[element].getValue() != '') {
this.inputByID[element].setValue(null);
}
}
};
this.appendChild(this.newsletterForm);
KPageDialog.prototype.draw.call(this);
};
BCWebsiteHomepage.prototype = new BCWebsiteTwoColumnHighlight();
BCWebsiteHomepage.prototype.constructor = BCWebsiteHomepage;
BCWebsiteHomepage.prototype.heightFix = 270 + 26;
BCWebsiteHomepage.rollOverTimer = null;
BCWebsiteHomepage.direction = 1;
BCWebsiteHomepage.Time = 6000;
BCWebsiteHomepage.counter = null;
function BCWebsiteHomepage(parent) {
if (parent != null) {
BCWebsiteTwoColumnHighlight.call(this, parent);
}
}
BCWebsiteHomepage.prototype.draw = function() {
var backSite = new BCGallery(this);
backSite.data = this.data.imagensRotativas;
Kinky.site.childWidget('/backgroundPage').appendChild(backSite, this.hash);
backSite.draw();
var clickArea = window.document.createElement('img');
clickArea.src = 'images/site/click-area.png';
clickArea.className = ' BCWebsiteHomepageClickArea ';
KSystem.addEventListener(clickArea, 'click', function(event) {
if (backSite.data.highlightItems[backSite.nPage] && backSite.data.highlightItems[backSite.nPage].url) {
var url = backSite.data.highlightItems[backSite.nPage].url;
if (url.indexOf('http://') == 0) {
window.open(url, '_blank');
}
else {
KBreadcrumb.dispatchURL({
url : url
});
}
}
});
this.panel.appendChild(clickArea);
backSite.pagination.style.width = (backSite.totalCount * 24) + 'px';
this.panel.appendChild(backSite.pagination);
var translations = this.getTranslation('BCFacebookShare');
var facebookSharePanel = new KPanel(this);
facebookSharePanel.addCSSClass('FacebookSharePanel');
facebookSharePanel.setTitle(translations.shareTitle);
var shareBt = new KLink(facebookSharePanel, 'javascript:void(0);');
shareBt.setLinkText(translations.share);
shareBt.addEventListener('click', function() {
window.open('http://www.facebook.com/sharer.php?u=http://' + encodeURIComponent(window.location.host));
});
facebookSharePanel.appendChild(shareBt);
this.appendChild(facebookSharePanel);
BCWebsiteTwoColumnHighlight.prototype.draw.call(this);
clearTimeout(BCWebsiteHomepage.rollOverTimer);
if (backSite.totalCount > 1) {
BCWebsiteHomepage.rollOverTimer = setTimeout(BCWebsiteHomepage.doAutoNext, BCWebsiteHomepage.Time);
}
};
BCWebsiteHomepage.prototype.onShow = function() {
BCWebsiteTwoColumnHighlight.prototype.onShow.call(this);
clearTimeout(BCWebsiteHomepage.rollOverTimer);
var backSite = Kinky.site.childWidget('/backgroundPage').childWidget('/rotation-gallery');
if (backSite != null) {
if (backSite.totalCount > 1) {
BCWebsiteHomepage.rollOverTimer = setTimeout(BCWebsiteHomepage.doAutoNext, BCWebsiteHomepage.Time);
}
}
};
BCWebsiteHomepage.prototype.onHide = function() {
clearTimeout(BCWebsiteHomepage.rollOverTimer);
BCWebsiteTwoColumnHighlight.prototype.onHide.call(this);
};
BCWebsiteHomepage.doAutoNext = function() {
clearTimeout(BCWebsiteHomepage.rollOverTimer);
var backSite = Kinky.site.childWidget('/backgroundPage').childWidget('/rotation-gallery');
KWidget.dispatchNext(null, backSite);
if (backSite.totalCount > 1) {
BCWebsiteHomepage.rollOverTimer = setTimeout(BCWebsiteHomepage.doAutoNext, BCWebsiteHomepage.Time);
}
};
BCWebsiteHomepage.prototype.changeBackgrounds = function(hash_to_activate) {
var backgroundSite = Kinky.site.childWidget('/backgroundSite');
var backgroundPage = Kinky.site.childWidget('/backgroundPage');
var backSiteOk = false;
while (!backSiteOk) {
var bg_site_child = backgroundSite.childWidgets(hash_to_activate);
if (bg_site_child != null) {
for ( var element in bg_site_child) {
bg_site_child = bg_site_child[element];
}
if (backgroundSite.getContext() != hash_to_activate) {
backgroundSite.hideContext();
backgroundSite.changeContext(hash_to_activate);
if (bg_site_child instanceof KImage && (bg_site_child.data != null)) {
backgroundSite.width = bg_site_child.data.width;
}
backgroundSite.setStyle({
width : backgroundSite.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - backgroundSite.width) / 2) + 'px'
});
backgroundSite.showContext();
}
backSiteOk = true;
}
if ((hash_to_activate == '/') || (hash_to_activate == '')) {
break;
}
if (!backSiteOk) {
hash_to_activate = hash_to_activate.substring(0, hash_to_activate.lastIndexOf('/'));
if (hash_to_activate == '') {
hash_to_activate = '/';
}
}
}
if (!backSiteOk) {
backgroundSite.hideContext();
backgroundSite.changeContext('/hidden');
}
backgroundPage.hideContext();
backgroundPage.changeContext(this.hash);
var backSite = Kinky.site.childWidget('/backgroundPage').childWidget('/rotation-gallery');
if (backSite != null) {
backgroundPage.width = backSite.width;
}
backgroundPage.setStyle({
width : backgroundPage.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - backgroundPage.width) / 2) + 'px'
});
backgroundPage.showContext();
};
BCContact.prototype = new BCOneColumnTitle();
BCContact.prototype.constructor = BCContact;
function BCContact(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCContact.prototype.draw = function() {
BCOneColumnTitle.prototype.draw.call(this);
if (this.childWidget('/richtext').content.getElementsByTagName('h2') && this.childWidget('/richtext').content.getElementsByTagName('h2')[0]){
this.childWidget('/richtext').content.getElementsByTagName('h2')[0].style.color = Kinky.site.colors.titleColor1;
}
}
BCContestParticipate.prototype = new BCOneColumnTitle();
BCContestParticipate.prototype.constructor = BCContestParticipate;
function BCContestParticipate(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCContestParticipate.prototype.draw = function() {
BCOneColumnTitle.prototype.draw.call(this);
}
BCContestPrizes.prototype = new BCOneColumnTitle();
BCContestPrizes.prototype.constructor = BCContestPrizes;
function BCContestPrizes(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCContestPrizes.prototype.draw = function() {
for (var index in Kinky.site.childWidget('menuPrincipal').data.pages){
//o melhor sera criar um template para a pagina passatempo para o caso de haver outro 7 (internal redirect generico) no menu
if (Kinky.site.childWidget('menuPrincipal').data.pages[index].template == 7){
var parentPageChilds = Kinky.site.childWidget('menuPrincipal').data.pages[index].pages;
for (var idx in parentPageChilds){
if (parentPageChilds[idx].template == 19){
BCContestDetail.participatePage = parentPageChilds[idx].urlHashText;
}
}
}
}
var participateBt = new BCKButton(this, 'Participar', 'participateBt', function(){
KBreadcrumb.dispatchURL({
hash : BCContestDetail.participatePage
});
});
this.appendChild(participateBt);
BCOneColumnTitle.prototype.draw.call(this);
}
BCContestTerms.prototype = new BCOneColumnTitle();
BCContestTerms.prototype.constructor = BCContestTerms;
function BCContestTerms(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCContestTerms.prototype.draw = function() {
BCOneColumnTitle.prototype.draw.call(this);
}
BCContestWinners.prototype = new BCOneColumnTitle();
BCContestWinners.prototype.constructor = BCContestWinners;
function BCContestWinners(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCContestWinners.prototype.draw = function() {
BCOneColumnTitle.prototype.draw.call(this);
}
BCDownloads.prototype = new BCOneColumnTitle();
BCDownloads.prototype.constructor = BCDownloads;
function BCDownloads(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCDownloads.prototype.draw = function() {
BCOneColumnTitle.prototype.draw.call(this);
}
BCFaq.prototype = new BCOneColumnTitle();
BCFaq.prototype.constructor = BCFaq;
function BCFaq(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCFaq.prototype.draw = function() {
BCOneColumnTitle.prototype.draw.call(this);
}
BCNews.prototype = new BCOneColumnTitle();
BCNews.prototype.constructor = BCNews;
function BCNews(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCNews.prototype.draw = function() {
var lista = this.childWidget('/item-list');
lista.showReadMore = true;
BCOneColumnTitle.prototype.draw.call(this);
}
BCProductDetail.prototype = new BCOneColumnTitle();
BCProductDetail.prototype.constructor = BCOneColumnTitle;
function BCProductDetail(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
this.addCSSClass('BCProductDetail');
}
}
BCProductDetail.prototype.draw = function() {
var richtextWidget = this.childWidget('/richtext');
richtextWidget.setTitle(this.data.titleText);
richtextWidget.setStyle({
color: Kinky.site.colors.titleColor1
}, KWidget.TITLE_DIV);
var div = window.document.createElement('div');
div.className = 'RootDiv';
if (Kinky.BASE_VERSION == '/biocolkids'){
richtextWidget.setStyle({
background : 'url("images/microsite/kids_product_detail_mid.png") repeat-y'
}, KWidget.CONTAINER_DIV);
richtextWidget.setStyle({
marginTop : '315px'
});
div.style.background = 'url("images/microsite/kids_product_detail_bot.png") no-repeat';
div.style.height = '19px';
div.style.width = '698px';
};
richtextWidget.childDiv(KWidget.ROOT_DIV).appendChild(div);
this.data.titleText = Kinky.site.childWidget(BCMicroSite.productPageHash).data.titleText;
BCOneColumnTitle.prototype.draw.call(this);
}
BCTestimony.prototype = new BCOneColumnTitle();
BCTestimony.prototype.constructor = BCTestimony;
function BCTestimony(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCTestimony.prototype.draw = function() {
BCOneColumnTitle.prototype.draw.call(this);
}
BCTextPage.prototype = new BCOneColumnTitle();
BCTextPage.prototype.constructor = BCTextPage;
function BCTextPage(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCTextPage.prototype.draw = function() {
BCOneColumnTitle.prototype.draw.call(this);
}
BCTips.prototype = new BCOneColumnTitle();
BCTips.prototype.constructor = BCTips;
function BCTips(parent) {
if (parent != null) {
BCOneColumnTitle.call(this, parent);
}
}
BCTips.prototype.draw = function() {
var lista = this.childWidget('/item-list');
lista.showReadMore = false;
BCOneColumnTitle.prototype.draw.call(this);
}
BCWebsiteContact.prototype = new BCWebsiteTwoColumnNoHighlight();
BCWebsiteContact.prototype.constructor = BCWebsiteContact;
function BCWebsiteContact(parent) {
if (parent != null) {
BCWebsiteTwoColumnNoHighlight.call(this, parent);
}
}
BCWebsiteContact.prototype.draw = function() {
BCWebsiteTwoColumnNoHighlight.prototype.draw.call(this);
var widgetChilds = this.childWidgets();
if (widgetChilds) {
for ( var index in widgetChilds) {
if (widgetChilds[index] instanceof BCContactRichtext) {
if (widgetChilds[index].hash == '/richtext/block1') {
widgetChilds[index].addCSSClass('FirstBox');
}
}
}
}
if (this.childWidget('/BCWebsiteFormContact')) {
var clearBoth = new KPanel(this);
clearBoth.addCSSClass('ClearBothIe');
clearBoth.go();
this.insertBefore(clearBoth, null, this.childWidget('/BCWebsiteFormContact'));
}
}
BCWebsiteExport.prototype = new BCWebsiteTwoColumnNoHighlight();
BCWebsiteExport.prototype.constructor = BCWebsiteExport;
function BCWebsiteExport(parent) {
if (parent != null) {
BCWebsiteTwoColumnNoHighlight.call(this, parent);
}
}
BCWebsiteExport.prototype.draw = function() {
var children = this.childWidgets();
for (var index in children){
if (children[index].className == 'BCContactRichtext'){
if (children[index].data.blockTitle == 'Intro Formul\u00e1rio'){
children[index].addCSSClass('FormIntroText');
}
}
}
BCWebsiteTwoColumnNoHighlight.prototype.draw.call(this);
}
BCWebsiteMap.prototype = new KPanel();
BCWebsiteMap.prototype.constructor = BCWebsiteMap;
function BCWebsiteMap(parent) {
if (parent) {
KPanel.call(this, parent);
}
}
BCWebsiteMap.prototype.draw = function() {
this.googleMap = new KMap(this, 'Seleccione a sua localiza\u00e7\u00e3o', 'locations');
{
this.googleMap.hash = '/page/map';
this.googleMap.searchBox = false;
this.googleMap.draggableMarkers = false;
this.googleMap.showInfoWindow = true;
this.googleMap.maxMarkers = 0;
this.googleMap.initialZoom = 11;
this.googleMap.removeOption = false;
this.googleMap.defaultIcon = '/images/site/map_pointer.png';
this.googleMap.designationBox = false;
}
this.googleMap.refresh();
this.appendChild(this.googleMap);
KPanel.prototype.draw.call(this);
this.googleMap.addBorder({
cssClass : 'BCWebsiteMapBox',
border : 10
});
this.placePoints();
};
BCWebsiteMap.prototype.placePoints = function() {
var googleMap = this.googleMap;
if (googleMap && googleMap.activated() && googleMap.map) {
for ( var index = BCSite.mapWindowDialog.data.items.length - 1; index != -1; --index) {
var coordinate = null;
eval('coordinate = new google.maps.LatLng(' + BCSite.mapWindowDialog.data.items[index].coordinate + ');');
var mapPoint = new Object();
mapPoint.coordinate = BCSite.mapWindowDialog.data.items[index].coordinate;
mapPoint.local = '';
mapPoint.city = '';
mapPoint.address = '';
if (BCSite.mapWindowDialog.data.items[index].designation)
mapPoint.designation = BCSite.mapWindowDialog.data.items[index].designation;
else
mapPoint.designation = '';
googleMap.placeMarker(coordinate, false, false, mapPoint);
}
var coordinate = null;
eval('coordinate = new google.maps.LatLng(' + BCSite.mapWindowDialog.currentPointInfo.coordinate + ');');
googleMap.map.setCenter(coordinate);
} else {
KSystem.addTimer('Kinky.getWidget(\'' + this.id + '\').placePoints()', 800);
}
};
BCWebsiteNews.prototype = new BCWebsiteTwoColumnNoHighlight();
BCWebsiteNews.prototype.constructor = BCWebsiteNews;
function BCWebsiteNews(parent) {
if (parent != null) {
BCWebsiteTwoColumnNoHighlight.call(this, parent);
}
}
BCWebsiteNews.prototype.draw = function() {
BCWebsiteTwoColumnNoHighlight.prototype.draw.call(this);
}
BCWebsiteNewsletter.prototype = new KPageDialog();
BCWebsiteNewsletter.prototype.constructor = BCWebsiteNewsletter;
function BCWebsiteNewsletter(parent) {
if (parent) {
KPageDialog.call(this, parent);
this.addCSSClass('BCWebsiteNewsletter');
this.newsletterForm = new KForm(this);
this.newsletterForm.staticForm = true;
this.newsletterForm.action = 'php:Entity:SubscribeNewsletter';
this.setStyle({
position : 'fixed'
});
BCWebsiteNewsletter.newsletterCategory = null;
this.translations = null;
}
}
BCWebsiteNewsletter.prototype.onLoad = function(data) {
KSystem.merge(this.data, data);
KPage.prototype.onLoad.call(this, this.data);
}
BCWebsiteNewsletter.prototype.onShow = function() {
KPageDialog.prototype.onShow.call(this);
this.setStyle({
left : (Math.floor(KSystem.getBrowserWidth() / 2)) + 'px',
top : '42px'
});
this.hideContext('result');
this.showContext('form');
this.newsletterForm.reset();
}
BCWebsiteNewsletter.prototype.draw = function() {
this.loadTranslations();
var dataTitle = new KText(this);
dataTitle.setText(this.translations.dataTitle);
this.appendChild(dataTitle, 'form');
var subscriberName = new KInput(this.newsletterForm, 'text', this.translations.name, 'entityName');
subscriberName.addCSSClass('NewsletterInput');
subscriberName.addValidator(/.+/, 'campo de preenchimento obrigat\u00f3rio');
subscriberName.setStyle({
labelPosition : 'inside'
});
this.newsletterForm.addInput(subscriberName);
var subscriberEmail = new KInput(this.newsletterForm, 'text', this.translations.email, 'entityEmail');
subscriberEmail.addCSSClass('NewsletterInput');
subscriberEmail.addValidator(/(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/, 'campo de preenchimento obrigat\u00f3rio');
subscriberEmail.setStyle({
labelPosition : 'inside'
});
this.newsletterForm.addInput(subscriberEmail);
this.newsletterForm.clearBoth();
var categoryTitle = new KText(this.newsletterForm);
categoryTitle.setText(this.translations.categoriesTitle);
categoryTitle.setStyle({
marginTop : '6px'
});
this.newsletterForm.appendChild(categoryTitle);
var categoriesChecks = new KCheckBox(this.newsletterForm, '', 'newsletterCategory', false);
for ( var index in this.data.categoriaDeNewsletter.itemList) {
categoriesChecks.addOption(this.data.categoriaDeNewsletter.itemList[index].id, this.data.categoriaDeNewsletter.itemList[index].title, true);
}
this.newsletterForm.addInput(categoriesChecks);
var submitButton = new BCWebsiteKInput(this.newsletterForm, this.translations.submit, 'submit');
this.newsletterForm.addInput(submitButton);
this.newsletterForm.onValidate = function(data, params, status) {
if (status) {
params.biocolNewsletter = 1;
this.disable();
return params;
}
else {
var first = true;
for ( var index in params) {
var input = params[index].getInput();
if (first) {
first = false;
input.focus();
}
input.style.color = 'red';
}
}
};
this.newsletterForm.onSuccess = function(data) {
this.enable();
this.reset();
/*
* BCSite.dialogWindow.params.type = 1;
*
* KDialog.show(BCSite.dialogWindow, { content : (data.errorCode == 1 ? this.parent.translations.successText : this.parent.translations.errorText ), title : (data.errorCode == 1 ? this.parent.translations.successTitle : this.parent.translations.errorTitle ) }); if (data.errorCode != 1){ BCSite.dialogWindow.widgetTitle.childNodes[0].style.color = 'red'; }
*/
var widget = this.getParent();
widget.resultText.setText(data.errorCode == 1 ? this.parent.translations.successText : this.parent.translations.errorText);
widget.hideContext('form');
widget.showContext('result');
};
this.newsletterForm.reset = function() {
for ( var element in this.inputByID) {
if (this.inputByID[element].getValue() != '') {
this.inputByID[element].setValue(null);
}
}
}
this.appendChild(this.newsletterForm, 'form');
this.resultText = new KText(this);
this.appendChild(this.resultText, 'result');
KPageDialog.prototype.draw.call(this);
}
BCWebsiteOpportunity.prototype = new BCWebsiteTwoColumnNoHighlight();
BCWebsiteOpportunity.prototype.constructor = BCWebsiteOpportunity;
function BCWebsiteOpportunity(parent) {
if (parent != null) {
BCWebsiteTwoColumnNoHighlight.call(this, parent);
}
}
BCWebsiteOpportunity.prototype.draw = function() {
if (this.childWidget('/job-form')){
var clearBoth = new KPanel(this);
clearBoth.addCSSClass('ClearBothIe');
clearBoth.go();
this.insertBefore(clearBoth, null, this.childWidget('/job-form'));
}
BCWebsiteTwoColumnNoHighlight.prototype.draw.call(this);
}
BCWebsitePressRelease.prototype = new BCWebsiteTwoColumnNoHighlight();
BCWebsitePressRelease.prototype.constructor = BCWebsitePressRelease;
function BCWebsitePressRelease(parent) {
if (parent != null) {
BCWebsiteTwoColumnNoHighlight.call(this, parent);
}
}
BCWebsitePressRelease.prototype.draw = function() {
BCWebsiteTwoColumnNoHighlight.prototype.draw.call(this);
}
BCWebsiteProductDetail.prototype = new BCWebsiteThreeColumnHighlight();
BCWebsiteProductDetail.prototype.constructor = BCWebsiteProductDetail;
BCWebsiteProductDetail.prototype.heightFix = 450;
function BCWebsiteProductDetail(parent) {
if (parent != null) {
BCWebsiteThreeColumnHighlight.call(this, parent);
}
}
BCWebsiteProductDetail.prototype.draw = function() {
BCWebsiteThreeColumnHighlight.prototype.draw.call(this);
var parentPage = Kinky.site.childWidget('/' + this.getHash().split('/')[1] + '/' + this.getHash().split('/')[2]);
var parentColor = parentPage.data.graphicStyle.colors.blockGraphicalDefinition.text;
var h2collection = this.childWidget('/richtext').content.getElementsByTagName('h2');
if (h2collection && h2collection.length > 0) {
for ( var index in h2collection) {
if (h2collection[index].tagName == 'H2') {
h2collection[index].style.color = parentColor;
}
}
}
}
BCWebsiteSearch.prototype = new BCWebsiteTwoColumnNoHighlight();
BCWebsiteSearch.prototype.constructor = BCWebsiteSearch;
function BCWebsiteSearch(parent) {
if (parent != null) {
BCWebsiteTwoColumnNoHighlight.call(this, parent);
}
}
BCWebsiteSearch.prototype.draw = function() {
BCWebsiteTwoColumnNoHighlight.prototype.draw.call(this);
}
BCWebsiteStoreFinder.prototype = new BCWebsiteTwoColumnNoHighlight();
BCWebsiteStoreFinder.prototype.constructor = BCWebsiteStoreFinder;
function BCWebsiteStoreFinder(parent) {
if (parent != null) {
BCWebsiteTwoColumnNoHighlight.call(this, parent);
// this.addLocationListener(BCWebsiteStoreFinder.addScrollListener);
this.timer = null;
}
}
BCWebsiteStoreFinder.prototype.draw = function() {
// this.mapContainer = new KPanel(this);
// this.mapContainer.addCSSClass('MapContainer');
//
// var maximizeBt = new KLink(this.mapContainer, 'javascript:void(0);', '/images/site/map_maximize.png');
// this.mapContainer.appendTitleChild(maximizeBt);
// maximizeBt.addEventListener('click', function() {
// KDialog.show(BCSite.mapWindowDialog, {
// content : new BCWebsiteMap(BCSite.mapWindowDialog),
// title : ''
// });
// });
//
// this.googleMap = new KMap(this.mapContainer, '', 'locations');
// {
// this.googleMap.hash = '/right-panel/map';
// this.googleMap.searchBox = false;
// this.googleMap.draggableMarkers = false;
// this.googleMap.showInfoWindow = true;
// this.googleMap.initialZoom = 11;
// this.googleMap.maxMarkers = 0;
// this.googleMap.removeOption = false;
// this.googleMap.defaultIcon = '/images/site/map_pointer.png';
//
// this.googleMap.designationBox = false;
// }
//
// this.mapContainer.appendChild(this.googleMap);
// this.mapContainer.setStyle( {
// top : '292px'
// });
// var bottomDiv = window.document.createElement('div');
// bottomDiv.className = 'BottomDiv';
// this.mapContainer.content.appendChild(bottomDiv);
// this.appendChild(this.mapContainer);
BCWebsiteTwoColumnNoHighlight.prototype.draw.call(this);
};
BCWebsiteStoreFinder.addScrollListener = function(widget, location){
if (location == '/localizador-de-lojas'){
if (widget.mapContainer){
var top = widget.mapContainer.panel.style.top;
var newTop = null;
this.timer = KSystem.addTimer(function(){
newTop = window.document.documentElement.scrollTop + parseInt(top.replace('px', '') - 200);
if ((parseInt(Kinky.site.panel.style.height.replace('px', '')) - newTop) < 960){
newTop = parseInt(Kinky.site.panel.style.height.replace('px', '')) - 960 ;
}else if( newTop < 292){
newTop = 292;
}
KEffects.addEffect(widget.mapContainer, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 1000,
gravity : {
y : 'top'
},
go : {
y : newTop
},
lock : {
x : true
}
});
}, 500, true);
}
}else{
if (this.timer){
KSystem.removeTimer(this.timer);
this.timer = null;
}
}
};
BCWebsiteTextPage.prototype = new BCWebsiteTwoColumnNoHighlight();
BCWebsiteTextPage.prototype.constructor = BCWebsiteTextPage;
function BCWebsiteTextPage(parent) {
if (parent != null) {
BCWebsiteTwoColumnNoHighlight.call(this, parent);
}
}
BCWebsiteTextPage.prototype.draw = function() {
BCWebsiteTwoColumnNoHighlight.prototype.draw.call(this);
}
BCKList.prototype = new KList();
BCKList.prototype.constructor = BCKList;
function BCKList(parent) {
if (parent != null) {
KList.call(this, parent);
}
}
BCKList.prototype.setTotalPages = function(mpages, clickable) {
this.totalPages = (mpages > 0) ? mpages : 0;
this.pagination.innerHTML = '';
if (this.hasTopPagination) {
this.topPagination.getElementsByTagName('div')[0].innerHTML = '';
}
for ( var i = 0; i < this.totalPages; i++) {
var pagesHTML = document.createElement('div');
pagesHTML.className = ' PgNumb ' + this.className + 'PgNum' + (i + 1) + ((this.nPage == i) ? " PgCurrent " : " ");
pagesHTML.innerHTML = (i + 1);
if (this.nPage == i){
pagesHTML.style.color = Kinky.site.colors.menuColor1;
}
if (clickable) {
KSystem.addEventListener(pagesHTML, 'click', BCKList.onPaginationClick);
}
if (this.hasTopPagination) {
var clonenode = pagesHTML.cloneNode(true);
if (clickable) {
KSystem.addEventListener(clonenode, 'click', BCKList.onPaginationClick);
}
this.topPagination.getElementsByTagName('div')[0].appendChild(clonenode);
}
this.pagination.appendChild(pagesHTML);
}
};
BCKList.prototype.draw = function(){
KList.prototype.draw.call(this);
var botoes = this.paginationBar.getElementsByTagName('BUTTON');
for (var i = 0; i != botoes.length; i++){
botoes[i].style.color = Kinky.site.colors.titleColor1;
if (/Prev/.test(botoes[i].className)){
botoes[i].innerHTML = '<';
}else{
botoes[i].innerHTML = '>';
}
}
};
BCKList.prototype.hideContext = function(context, element) {
KCSS.removeCSSClass('PgCurrent', this.pagination.childNodes[this.nPage]);
this.pagination.childNodes[this.nPage].style.color = Kinky.site.colors.textColor;
KList.prototype.hideContext.call(this, context, element);
};
BCKList.prototype.showContext = function(context, element) {
if (this.totalPages > 1) {
KCSS.addCSSClass('PgCurrent', this.pagination.childNodes[this.nPage]);
this.pagination.childNodes[this.nPage].style.color = Kinky.site.colors.menuColor1;
}
KList.prototype.showContext.call(this, context, element);
};
BCKList.onPaginationClick = function(evt) {
var widget = KSystem.getEventWidget(evt);
var myTarget = KSystem.getEventTarget(evt);
var indx = (/[0-9]/.exec(myTarget.className)[0] * 1) - 1;
KCSS.addCSSClass('PgCurrent', myTarget);
myTarget.style.color = Kinky.site.colors.menuColor1;
KCSS.removeCSSClass('PgCurrent', myTarget.parentNode.childNodes[widget.nPage]);
myTarget.parentNode.childNodes[widget.nPage].style.color = Kinky.site.colors.textColor;
var pageGoTo = '/page/' + indx;
if (widget.paginationDispatchType == KBreadcrumb.DISPATCH_URL) {
KBreadcrumb.dispatchURL( {
action : pageGoTo
});
}
else {
KBreadcrumb.dispatchEvent(widget.id, {
action : pageGoTo
});
}
};
BCWebsiteKList.prototype = new KList();
BCWebsiteKList.prototype.constructor = BCWebsiteKList;
function BCWebsiteKList(parent) {
if (parent != null) {
KList.call(this, parent);
this.paginationBar.removeChild(this.prevButton);
this.paginationBar.removeChild(this.nextButton);
this.perPage = 10;
this.nPage = 0;
this.isPaginated = true;
this.showReadMore = true;
this.widget_translations = {};
this.loadTranslations();
var translations = this.getTranslation('BCWebsiteKList');
var prevBt = new BCWebsiteKButton(this, '< ' + translations.previousPage, 'less', null);
prevBt.go();
var nextBt = new BCWebsiteKButton(this, translations.nextPage + ' >', 'more', null);
nextBt.go();
this.prevButton = prevBt;
this.paginationBar.appendChild(this.prevButton.panel);
this.prevButton.addEventListener('click', function(e){
var widget = KSystem.getEventWidget(e, 'BCWebsiteKList');
KWidget.dispatchPrevious(e, widget);
});
this.nextButton = nextBt;
this.paginationBar.appendChild(this.nextButton.panel);
this.nextButton.addEventListener('click', function(e){
var widget = KSystem.getEventWidget(e, 'BCWebsiteKList');
KWidget.dispatchNext(e, widget);
});
}
}
BCWebsiteKList.prototype.loadTranslations = function() {
};
BCWebsiteKList.prototype.getTranslation = function(widgetClass) {
if (this.widget_translations[widgetClass]) {
return this.widget_translations[widgetClass];
}
};
BCWebsiteKList.prototype.setTotalPages = function(mpages, clickable) {
this.totalPages = (mpages > 0) ? mpages : 0;
this.pagination.innerHTML = '';
if (this.hasTopPagination) {
this.topPagination.getElementsByTagName('div')[0].innerHTML = '';
}
var pagesHTML = document.createElement('div');
pagesHTML.innerHTML = this.nPage + 1 + '/' + this.totalPages;
this.pagination.appendChild(pagesHTML);
};
BCWebsiteKList.prototype.showContext = function(context, element) {
if(this.pagination.childNodes[0].tagName == 'DIV'){
this.pagination.childNodes[0].innerHTML = this.nPage + 1 + '/' + this.totalPages;
}
if (this.totalPages <= 1) {
this.setStyle( {
display : 'none'
}, KWidget.PAGINATION_DIV);
}else{
this.setStyle( {
display : 'block'
}, KWidget.PAGINATION_DIV);
}
KList.prototype.showContext.call(this, context, element);
};
BCProfessionalAreaGallery.prototype = new KPanel();
BCProfessionalAreaGallery.prototype.constructor = BCProfessionalAreaGallery;
function BCProfessionalAreaGallery(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.addQueryListener(BCProfessionalAreaGallery.changeGallery, [ '/category/*' ]);
this.loadService = true;
}
}
BCProfessionalAreaGallery.prototype.onLoad = function(data) {
this.data.galleryItems = data.galleryItems;
this.draw();
}
BCProfessionalAreaGallery.prototype.draw = function() {
if (this.parent.childWidget('/menu').data && this.parent.childWidget('/menu').data.itemList && this.getQuery()) {
var brotherData = this.parent.childWidget('/menu').data.itemList;
var categoryID = this.getQuery().split('/')[2];
for ( var menuIdx in brotherData) {
if (brotherData[menuIdx].id == categoryID) {
this.setTitle(brotherData[menuIdx].title);
break;
}
}
}
if (this.data.galleryItems && this.data.galleryItems.length > 0) {
for ( var index in this.data.galleryItems) {
var item = new KText(this);
item.setTitle(this.data.galleryItems[index].fileTitle);
item.setText('Download');
item.file = this.data.galleryItems[index].fileInternalPath;
item.addEventListener('click', function(e) {
var widget = KSystem.getEventWidget(e);
window.open(widget.file);
}, KWidget.CONTENT_DIV);
this.appendChild(item);
}
} else {
var noContent = new KText(this);
noContent.addCSSClass('NoContent');
noContent.setText('N\u00e3o existem resultados a apresentar.');
this.appendChild(noContent);
}
KPanel.prototype.draw.call(this);
};
BCProfessionalAreaGallery.changeGallery = function(widget, query) {
widget.data.config.categoryID = query.split('/')[2];
widget.refresh();
};
BCProfessionalAreaMenu.prototype = new KPanel();
BCProfessionalAreaMenu.prototype.constructor = BCProfessionalAreaMenu;
function BCProfessionalAreaMenu(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.addQueryListener(BCProfessionalAreaMenu.changeGallery, [ '/category/*' ]);
this.loadService = true;
this.lastMarked = null;
this.hash = '/menu';
}
}
BCProfessionalAreaMenu.prototype.onShow = function() {
if (!this.getQuery()){
KBreadcrumb.dispatchURL({
query : '/category/' + this.data.itemList[0].id
});
}
}
BCProfessionalAreaMenu.prototype.onLoad = function(data) {
this.removeAllChildren();
this.data.itemList = {};
KSystem.merge(this.data.itemList, data.itemList);
this.draw();
};
BCProfessionalAreaMenu.prototype.draw = function() {
for (var index in this.data.itemList){
var menuItem = new KLink(this, 'javascript:void(0);');
menuItem.setLinkText(this.data.itemList[index].title.replace('\u00c1rea Profissional ', ''));
menuItem.hash = '/category/' + this.data.itemList[index].id;
menuItem.addEventListener('click', function(e){
var widget = KSystem.getEventWidget(e);
KBreadcrumb.dispatchURL({
query : widget.hash
});
});
this.appendChild(menuItem);
}
KPanel.prototype.draw.call(this);
};
BCProfessionalAreaMenu.changeGallery = function(widget, query) {
if (widget.lastMarked){
widget.lastMarked.removeCSSClass('Selected');
}
var element = widget.childWidget(query);
element.addCSSClass('Selected');
widget.lastMarked = element;
};
BCFormContact.prototype = new KForm();
BCFormContact.prototype.constructor = BCFormContact;
function BCFormContact(parent) {
if (parent != null) {
KForm.call(this, parent);
this.staticForm = true;
this.action = 'php:Contact:Submit';
this.translations = null;
}
}
BCFormContact.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
var contactName = new KInput(this, 'text', this.translations.name, 'contactName');
contactName.addCSSClass('NameInput');
contactName.setStyle({
labelPosition : 'inside'
});
contactName.addValidator(/.+/, '');
this.addInput(contactName);
var contactEmail = new KInput(this, 'text', this.translations.email, 'contactEmail');
contactEmail.addCSSClass('EmailInput');
contactEmail.setStyle({
labelPosition : 'inside'
});
contactEmail.addValidator(/(\w+@[a-zA-Z_-]+?\.[a-zA-Z]{2,6})/, '');
this.addInput(contactEmail);
var contactPhone = new KInput(this, 'text', this.translations.phone, 'contactPhone');
contactPhone.addCSSClass('PhoneInput');
contactPhone.setStyle({
labelPosition : 'inside'
});
this.addInput(contactPhone);
var contactMessage = new KInput(this, 'textarea', this.translations.message, 'contactMessage');
contactMessage.addCSSClass('MessageInput');
contactMessage.setStyle({
labelPosition : 'inside'
});
contactMessage.addValidator(/.+/, '');
this.addInput(contactMessage);
var mandatoryText = new KText(this);
mandatoryText.addCSSClass('MandatoryText');
mandatoryText.setText(this.translations.mandatoryFields);
this.appendChild(mandatoryText);
var submitButton = new BCButton(this, this.translations.submit, 'submit');
this.addInput(submitButton);
KForm.prototype.draw.call(this);
};
BCFormContact.prototype.onValidate = function(text, params, status) {
if (status) {
params.categoryID = this.data.config.contentID;
return params;
} else {
var first = true;
for ( var element in params) {
var input = params[element].getInput();
if (first) {
first = false;
input.focus();
}
input.style.color = 'red';
// params[element].showErrorMessage();
}
return false;
}
};
BCFormContact.prototype.onSuccess = function(data) {
BCMicroSite.dialogWindow.params.type = 0;
KDialog.show(BCMicroSite.dialogWindow, {
content : (data.errorCode == 1 ? this.translations.successText : this.translations.errorText ),
title : (data.errorCode == 1 ? this.translations.successTitle : this.translations.errorTitle )
});
if (data.errorCode != 1){
BCMicroSite.dialogWindow.widgetTitle.childNodes[0].style.color = '#EF4048';
}
};
BCFormContact.prototype.onError = function(data) {
KDialog.show(BCMicroSite.dialogWindow, {
content : this.translations.errorText,
title : this.translations.errorTitle,
closeCallback : function(widget) {
KDialog.close(null, BCMicroSite.dialogWindow);
}
});
};
BCMappedList.prototype = new KPanel();
BCMappedList.prototype.constructor = BCMappedList;
function BCMappedList(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
}
}
BCMappedList.prototype.onLoad = function(data) {
if (!this.data){
this.data = {};
}
KSystem.merge(this.data, data);
this.draw();
}
BCMappedList.prototype.draw = function() {
var translations = this.getParent('KPage').getTranslation(this.className);
if (this.data.itemList.length > 0) {
// lista do topo, com mapeamento:
var topList = new KPanel(this);
topList.addCSSClass('TopList');
this.appendChild(topList);
var bottomBorder = window.document.createElement('div');
bottomBorder.className = 'BottomBorder';
topList.childDiv(KWidget.CONTAINER_DIV).appendChild(bottomBorder);
// lista do fundo:
var mainList = new KPanel(this);
mainList.addCSSClass('MainList');
var count = 0;
for ( var index in this.data.itemList) {
var itemInfo = this.data.itemList[index];
var link = this.getLink({
query : '/scroll/' + itemInfo.id
});
var topLink = new KLink(this, link);
topLink.setLinkText(itemInfo.title);
topLink.addCSSClass('TopLink');
topList.appendChild(topLink);
var backLink = this.getLink({
query : ''
});
var topAnswer = new KPanel(this);
topAnswer.addCSSClass('TopAnswer');
var backToTop = new KLink(topAnswer, backLink);
backToTop.setLinkText(translations.btBack);
backToTop.addCSSClass('TopLink');
backToTop.setStyle({
backgroundPosition : '0px 0px'
});
backToTop.addEventListener('click', function(event) {
KEffects.addEffect(backToTop, {
f : KEffects.easeOutExpo,
type : 'window-scroll-to',
duration : 1000,
go : {
x : 0,
y : 0
}
});
});
backToTop.addEventListener('mouseover', function(event) {
var widget = KSystem.getEventWidget(event);
KEffects.addEffect(widget, {
f : KEffects.easeOutExpo,
type : 'background-move',
duration : 400,
go : {
x : 0,
y : -5
}
});
});
backToTop.addEventListener('mouseout', function(event) {
var widget = KSystem.getEventWidget(event);
KEffects.addEffect(widget, {
f : KEffects.easeOutExpo,
type : 'background-move',
duration : 400,
go : {
x : 0,
y : 0
}
});
});
topAnswer.appendChild(backToTop);
mainList.appendChild(topAnswer);
var mainText = new KText(this);
mainText.addCSSClass('MainText');
mainText.setTitle(itemInfo.title);
mainText.setText(itemInfo.text);
mainText.addQueryListener(function(widget, query) {
KEffects.addEffect(backToTop, {
f : KEffects.easeOutExpo,
type : 'window-scroll-to',
duration : 1000,
go : {
x : 0,
y : widget.offsetTop() - 36
}
});
}, [ '/scroll/' + itemInfo.id ]);
mainList.appendChild(mainText);
if (Kinky.site.colors && Kinky.site.colors.textColor) {
topLink.setStyle({
color : Kinky.site.colors.textColor
}, KLink.LINK_ELEMENT);
backToTop.setStyle({
color : Kinky.site.colors.textColor
}, KLink.LINK_ELEMENT);
mainText.setStyle({
color : Kinky.site.colors.textColor
});
}
if (Kinky.site.colors && Kinky.site.colors.titleColor2) {
mainText.setStyle({
color : Kinky.site.colors.titleColor2
}, KWidget.TITLE_DIV);
}
count++;
if (count % 3 == 0) {
topList.clearBoth();
}
}
this.appendChild(mainList);
} else {
var noContent = new KText(this);
noContent.addCSSClass('NoContent');
noContent.setText(translations.noContent);
if (Kinky.site.colors && Kinky.site.colors.textColor) {
noContent.setStyle({
color : Kinky.site.colors.textColor
});
}
this.appendChild(noContent);
}
KPanel.prototype.draw.call(this);
};
BCGallery.prototype = new KList();
BCGallery.prototype.constructor = BCGallery;
function BCGallery(parent) {
if (parent != null) {
KList.call(this, parent);
this.hash = '/rotation-gallery';
this.perPage = 1;
this.waitForLoad = true;
}
this.afterNext = function() {
KBreadcrumb.dispatchEvent(this.id, {
action : '/page/0'
});
};
this.beforePrevious = function() {
KBreadcrumb.dispatchEvent(this.id, {
action : '/page/' + (this.totalCount - 1)
});
};
}
BCGallery.prototype.onLoad = function(data) {
if (this.data == null) {
this.data = {};
}
KSystem.merge(this.data, data);
this.draw();
};
BCGallery.prototype.draw = function() {
if (this.data.highlightItems.length > 0) {
for ( var index in this.data.highlightItems) {
var fileInfo = this.data.highlightItems[index];
var image = new KImage(this, fileInfo.image);
image.effects = {
enter : {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : 1000,
go : {
alpha : 1
},
from : {
alpha : 0
}
}
};
image.waitForLoad = true;
image.onShow = function() {
this.setStyle({
width : this.data.width + 'px',
opacity : '0'
});
this.parent.width = this.data.width;
this.parent.setStyle({
width : this.data.width + 'px'
});
Kinky.site.backgroundPage.width = this.data.width;
Kinky.site.backgroundPage.setStyle({
width : this.data.width + 'px',
left : Math.round((Math.max(960, KSystem.getBrowserWidth()) - this.data.width) / 2) + 'px'
});
KImage.prototype.onShow.call(this);
};
this.appendChild(image);
}
this.totalCount = this.nChildren;
}
this.setTotalPages(this.totalCount, false);
KList.prototype.draw.call(this);
};
BCGallery.prototype.setTotalPages = function(mpages, clickable) {
this.totalPages = (mpages > 0) ? mpages : 0;
this.pagination.innerHTML = '';
for ( var i = 0; i < this.totalPages; i++) {
var pagesHTML = document.createElement('div');
pagesHTML.className = ' ' + this.className + 'PgNumb ' + this.className + 'PgNum' + (i + 1) + ((this.nPage == i) ? " " + this.className + "PgCurrent " : " ");
pagesHTML.innerHTML = ' ';
KSystem.addEventListener(pagesHTML, 'click', BCGallery.onPaginationClick);
if(Kinky.site.theme != null && Kinky.site.theme != '' && Kinky.site.theme != 'none') {
pagesHTML.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
}
pagesHTML.style.backgroundRepeat = 'no-repeat';
this.pagination.appendChild(pagesHTML);
}
};
BCGallery.onPaginationClick = function(evt) {
clearTimeout(BCHomepage.rollOverTimer);
var backSite = Kinky.site.childWidget('/backgroundPage').childWidget('/rotation-gallery');
var myTarget = KSystem.getEventTarget(evt);
var indx = (/[0-9]/.exec(myTarget.className)[0] * 1) - 1;
KBreadcrumb.dispatchEvent(backSite.id, {
action : '/page/' + indx
});
if (backSite.totalCount > 1)
BCHomepage.rollOverTimer = setTimeout(BCHomepage.doAutoNext, BCHomepage.Time);
};
BCGallery.prototype.hideContext = function(context, element) {
KWidget.prototype.hideContext.call(this, context, element);
if(this.totalPages > 0)
KCSS.removeCSSClass(this.className + 'PgCurrent', this.pagination.childNodes[this.nPage]);
};
BCGallery.prototype.showContext = function(context, element) {
this.setStyle({
opacity : 0
});
KWidget.prototype.showContext.call(this, context, element);
if(this.totalPages > 0)
KCSS.addCSSClass(this.className + 'PgCurrent', this.pagination.childNodes[this.nPage]);
};
BCFooterLeftMenu.prototype = new KIndex();
BCFooterLeftMenu.prototype.constructor = BCFooterLeftMenu;
function BCFooterLeftMenu(parent, id, data) {
if (parent) {
KIndex.call(this, parent, id, data);
BCFooterLeftMenu.activeTool = null;
}
}
BCFooterLeftMenu.prototype.draw = function() {
this.loadIndex(this.data);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.activate();
this.markIndex(this.getHash());
};
BCFooterLeftMenu.prototype.loadIndex = function(page, level, topUL, parent, pageIndex) {
if (!pageIndex) {
pageIndex = 1;
}
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page, pageIndex++);
}
} else {
if (level == 1) {
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
} catch (e) {
dump(parent, false, true);
}
var a = window.document.createElement('a');
a.appendChild(window.document.createTextNode(page.menuText));
a.style.color = Kinky.site.colors.footerMenuColor2;
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
this.subIndex[page.urlHashText] = li;
li.appendChild(a);
topUL.appendChild(li);
}
}
};
BCFooterMenu.prototype = new KIndex();
BCFooterMenu.prototype.constructor = BCFooterMenu;
function BCFooterMenu(parent, id, data) {
if (parent) {
KIndex.call(this, parent, id, data);
BCFooterMenu.activeTool = null;
}
}
BCFooterMenu.prototype.draw = function() {
var biocolLink = new KLink(this, 'http://www.biocol.pt', '', '_blank');
biocolLink.addCSSClass('BCFooterLogo');
biocolLink.setStyle({
backgroundImage: 'url("' + Kinky.site.theme + '")',
backgroudRepeat: 'no-repeat'
}, KLink.TEXT_ELEMENT);
this.appendChild(biocolLink);
this.loadIndex(this.data);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.activate();
this.markIndex(this.getHash());
var sharePanel = new KPanel(this);
sharePanel.hash = '/share-panel';
sharePanel.addCSSClass('BCSharePanel');
var facebookShare = new KButton(this, ' ', 'shareBook', BCFooterMenu.shareMe);
facebookShare.addCSSClass('BCShareBook');
sharePanel.appendChild(facebookShare);
var twitterShare = new KButton(this, ' ', 'shareTwitter', BCFooterMenu.shareMeTwitter);
twitterShare.addCSSClass('BCShareTwitter');
sharePanel.appendChild(twitterShare);
this.appendChild(sharePanel);
sharePanel.go();
};
BCFooterMenu.shareMe = function(event) {
var widget = KSystem.getEventWidget(event);
window.open('http://www.facebook.com/sharer.php?u=http://' + encodeURIComponent(window.location.host) + '/' + Kinky.DEFAULT_LANG + '/');
};
BCFooterMenu.shareMeTwitter = function(event) {
var widget = KSystem.getEventWidget(event);
window.open('http://twitter.com/home?status=' + encodeURIComponent(BCMicroSite.twitter));
};
BCFooterMenu.prototype.loadIndex = function(page, level, topUL, parent, pageIndex) {
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page, pageIndex++);
}
} else {
if (level == 1) {
var buttonType = ((/newsletter/.test(page.urlHashText) || /professional/.test(page.urlHashText)) ? 'Special' : '');
var li = window.document.createElement('li');
li.name = level;
var leftDiv = window.document.createElement('div');
leftDiv.className = 'ButtonLeft' + buttonType;
leftDiv.link = page.urlHashText;
if (buttonType == 'Special'){
KSystem.addEventListener(leftDiv, 'click', function(e){
var el = KSystem.getEventTarget(e);
KBreadcrumb.dispatchURL({
hash: el.link
});
});
}
var middleDiv = window.document.createElement('div');
middleDiv.className = 'ButtonMiddle' + buttonType;
var rightDiv = window.document.createElement('div');
rightDiv.className = 'ButtonRight' + buttonType;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
} catch (e) {
dump(parent, false, true);
}
var a = window.document.createElement('a');
a.style.color = Kinky.site.colors.footerMenuColor1;
a.appendChild(window.document.createTextNode(page.menuText));
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
this.subIndex[page.urlHashText] = li;
middleDiv.appendChild(a);
leftDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
leftDiv.style.backgroundRepeat = 'no-repeat';
middleDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
middleDiv.style.backgroundRepeat = 'no-repeat';
rightDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
rightDiv.style.backgroundRepeat = 'no-repeat';
li.appendChild(leftDiv);
li.appendChild(middleDiv);
li.appendChild(rightDiv);
topUL.appendChild(li);
}
}
};
BCMainMenu.prototype = new KIndex();
BCMainMenu.prototype.constructor = BCMainMenu;
function BCMainMenu(parent, id, data) {
if (parent) {
KIndex.call(this, parent, id, data);
this.changeMenuIndex = 0;
}
}
BCMainMenu.prototype.setMarked = function(hash) {
this.markIndex(hash);
};
BCMainMenu.prototype.draw = function() {
this.changeMenuIndex = Math.round(this.data.pages.length / 2);
this.loadIndex(this.data);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.activate();
this.markIndex(this.getHash());
};
BCMainMenu.prototype.loadIndex = function(page, level, topUL, parent, pageIndex) {
if (!pageIndex) {
pageIndex = 1;
}
var menuColor1 = Kinky.site.colors.menuColor1;
var menuColor2 = Kinky.site.colors.menuColor2;
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page, pageIndex++);
}
} else {
if (level == 1) {
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
} catch (e) {
dump(parent, false, true);
}
var background = window.document.createElement(this.tagNames[Kinky.HTML_READY][KWidget.BACKGROUND_DIV]);
background.id = li.id + '_background';
background.className = ' KWidgetPanelBackground MainLinkBackground ';
background.style.position = 'absolute';
background.style.top = '-22px';
background.style.left = '0px';
li.appendChild(background);
var leftDiv = window.document.createElement('div');
leftDiv.className = 'MainLinkLeft';
leftDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
leftDiv.style.backgroundRepeat = 'no-repeat';
var middleDiv = window.document.createElement('div');
middleDiv.className = 'MainLinkMiddle';
middleDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
middleDiv.style.backgroundRepeat = 'no-repeat';
var rightDiv = window.document.createElement('div');
rightDiv.className = 'MainLinkRight';
rightDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
rightDiv.style.backgroundRepeat = 'no-repeat';
background.appendChild(leftDiv);
background.appendChild(middleDiv);
background.appendChild(rightDiv);
var contentContainer = window.document.createElement(this.tagNames[Kinky.HTML_READY][KWidget.CONTAINER_DIV]);
contentContainer.className = ' KWidgetPanelContentContainer MainLinkContentContainer ';
contentContainer.style.clear = 'both';
contentContainer.style.position = 'relative';
li.appendChild(contentContainer);
var a = window.document.createElement('a');
contentContainer.appendChild(a);
if (page.graphicStyle && page.graphicStyle.textImages && page.graphicStyle.textImages.pageMenuTitle) {
a.appendChild(KCSS.img(page.graphicStyle.textImages.pageMenuTitle.base, page.menuText, page.titleText));
} else {
a.appendChild(window.document.createTextNode(page.menuText));
if (pageIndex <= this.changeMenuIndex) {
a.style.color = menuColor1;
} else {
a.style.color = menuColor2;
}
}
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
KSystem.addEventListener(a, 'mouseover', function(event) {
var liParent = a.parentNode.parentNode;
if (liParent.alt != 1) {
var target = document.getElementById(li.id + '_background');
KEffects.addEffect(target, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 450,
go : {
y : 0
},
lock : {
x : true
}
});
}
});
KSystem.addEventListener(a, 'mouseout', function(event) {
var liParent = a.parentNode.parentNode;
if (liParent.alt != 1) {
var target = document.getElementById(li.id + '_background');
KEffects.addEffect(target, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 450,
go : {
y : -22
},
lock : {
x : true
}
});
}
});
topUL.appendChild(li);
this.subIndex[page.urlHashText] = li;
}
}
};
BCMainMenu.prototype.markIndex = function(hash) {
if (this.lastMarked[1] != null && this.lastMarked[1] != this.subIndex[hash]) {
this.lastMarked[1].alt = 0;
var target = document.getElementById(this.lastMarked[1].id + '_background');
KEffects.addEffect(target, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 450,
go : {
y : -22
},
lock : {
x : true
}
});
}
KIndex.prototype.markIndex.call(this, hash);
if (this.lastMarked[1] != null) {
this.lastMarked[1].alt = 1;
var target = document.getElementById(this.lastMarked[1].id + '_background');
KEffects.addEffect(target, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 450,
go : {
y : 0
},
lock : {
x : true
}
});
}
};
BCSubPagesMenu.prototype = new KIndex();
BCSubPagesMenu.prototype.constructor = BCSubPagesMenu;
function BCSubPagesMenu(parent) {
if (parent != null) {
KIndex.call(this, parent, 'pageMenu');
this.addLocationListener(BCSubPagesMenu.changeContext);
this.setStyle({
display : 'none'
});
}
}
BCSubPagesMenu.prototype.load = function() {
if (this.activated()) {
this.draw();
} else {
this.activate();
}
};
BCSubPagesMenu.prototype.draw = function() {
var h = this.getHash();
var parentPage = h != null ? Kinky.site.childWidget('/' + h.split('/')[1]) : null;
if (parentPage && parentPage.data && parentPage.data.pages) {
var parentTitle = new KText(this);
parentTitle.addCSSClass('ParentTitle');
parentTitle.setText(parentPage.data.titleText);
this.appendChild(parentTitle);
this.setStyle( {
display : 'block'
});
var pageData = new Object();
pageData.pages = parentPage.data.pages;
this.loadIndex(pageData);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.markIndex(this.getHash());
}
this.activate();
};
BCSubPagesMenu.prototype.loadIndex = function(page, level, topUL, parent) {
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
}
else {
if (level == 1) {
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
}
catch (e) {
dump(parent, false, true);
}
if (level == 1) {
var leftDiv = window.document.createElement('div');
leftDiv.className = 'LeftBt';
var middleDiv = window.document.createElement('div');
middleDiv.className = 'MiddleBt';
var rightDiv = window.document.createElement('div');
rightDiv.className = 'RightBt';
}
var a = window.document.createElement('a');
if (page.graphicStyle && page.graphicStyle.textImages && page.graphicStyle.textImages.pageMenuTitle) {
a.appendChild(KCSS.img(page.graphicStyle.textImages.pageMenuTitle.base, page.menuText, page.titleText));
} else {
a.appendChild(window.document.createTextNode(page.menuText));
}
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
this.subIndex[page.urlHashText] = li;
middleDiv.appendChild(a);
li.appendChild(leftDiv);
li.appendChild(middleDiv);
li.appendChild(rightDiv);
topUL.appendChild(li);
}
}
if(page.pages.length) {
for ( var index = page.pages.length - 1; index != -1; --index) {
this.loadIndex(page.pages[index], level + 1, ul, page);
}
}
};
BCSubPagesMenu.changeContext = function(widget, hash) {
if (!(Kinky.site.childWidget(hash) instanceof KPageDialog)) {
if (!(Kinky.site.childWidget(hash) instanceof BCWebsiteTwoColumnNoHighlight)){
widget.setStyle({
display : 'none'
});
return;
}else{
widget.setStyle({
display : 'block'
});
widget.refresh();
}
}
};
BCMap.prototype = new KPanel();
BCMap.prototype.constructor = BCMap;
function BCMap(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
BCMap.districtSelected = null;
this.addQueryListener(BCMap.changeRegion, [ '/region/*' ]);
this.hash = '/widget-map';
this.points = {};
this.pointsAddedToMap = {};
}
}
BCMap.prototype.onLoad = function(data) {
this.data.districts = {};
KSystem.merge(this.data.districts, data.districts);
this.draw();
};
BCMap.prototype.draw = function() {
this.googleMap = new KMap(this, 'Seleccione a sua localiza\u00e7\u00e3o', 'locations');
{
this.googleMap.hash = '/onde-comprar/mapa';
this.googleMap.searchBox = false;
this.googleMap.draggableMarkers = false;
this.googleMap.showInfoWindow = true;
this.googleMap.initialZoom = 11;
this.googleMap.removeOption = false;
this.googleMap.designationBox = false;
}
this.appendChild(this.googleMap);
this.districsPanel = new KPanel(this);
this.districsPanel.addCSSClass('RegionPanel');
for ( var index in this.data.districts) {
var regionItem = new KLink(this.districsPanel, 'javascript:void(0);');
regionItem.setLinkText(this.data.districts[index].name);
regionItem.hash = '/district-item/' + this.data.districts[index].regionID;
regionItem.data.districtName = this.data.districts[index].name;
regionItem.data.districtID = this.data.districts[index].regionID;
if (this.data.districts[index].totalStores > 0) {
regionItem.addEventListener('click', function(e) {
var widget = KSystem.getEventWidget(e);
KBreadcrumb.dispatchURL({
query : '/region/' + widget.data.districtID
});
});
regionItem.setStyle({
backgroundImage : 'url("' + Kinky.site.theme + '")',
backgroudRepeat : 'no-repeat',
backgroundPosition : '-280px -230px'
});
} else {
regionItem.addCSSClass('WithoutItems');
}
this.districsPanel.appendChild(regionItem);
}
this.appendChild(this.districsPanel);
KPanel.prototype.draw.call(this);
};
BCMap.changeRegion = function(widget, query) {
if (!widget.activated()) {
return;
}
var districtID = query.split('/')[2];
if (widget.districsPanel.childWidget('/district-item/' + districtID)) {
if (BCMap.districtSelected) {
KEffects.addEffect(BCMap.districtSelected.link, {
f : KEffects.easeOutExpo,
type : 'rgb',
duration : 500,
go : {
rgb : '#383838'
}
});
KEffects.addEffect(BCMap.districtSelected.link, {
f : KEffects.easeOutExpo,
type : 'font-resize',
unit : 'px',
duration : 500,
go : {
fontSize : 12
},
from : {
fontSize : 18
}
});
KEffects.addEffect(BCMap.districtSelected, {
f : KEffects.easeOutExpo,
type : 'resize',
unit : 'px',
duration : 500,
go : {
height : 12
},
from : {
height : 20
},
lock : {
width : true
}
});
KEffects.addEffect(BCMap.districtSelected, {
f : KEffects.easeOutExpo,
type : 'background-move',
duration : 500,
go : {
x : -280,
y : -230
}
});
BCMap.districtSelected.removeCSSClass('Selected');
}
var districtItem = widget.districsPanel.childWidget('/district-item/' + districtID);
KEffects.addEffect(districtItem.link, {
f : KEffects.easeOutExpo,
type : 'rgb',
duration : 1000,
go : {
rgb : '#ffffff'
}
});
KEffects.addEffect(districtItem.link, {
f : KEffects.easeOutExpo,
type : 'font-resize',
unit : 'px',
duration : 500,
go : {
fontSize : 18
},
from : {
fontSize : 12
}
});
KEffects.addEffect(districtItem, {
f : KEffects.easeOutExpo,
type : 'resize',
unit : 'px',
duration : 500,
go : {
height : 20
},
from : {
height : 12
},
lock : {
width : true
}
});
KEffects.addEffect(districtItem, {
f : KEffects.easeOutExpo,
type : 'background-move',
duration : 1000,
go : {
x : -420,
y : -230
}
});
districtItem.addCSSClass('Selected');
var districtName = districtItem.data.districtName;
BCMap.districtSelected = districtItem;
}
if (districtName) {
if(widget.points[districtID] == null || widget.points[districtID].length != 1) {
var address = {
value : districtName == 'V. do Castelo' ? 'Viana do Castelo' : districtName
};
widget.googleMap.geocodeAddress(address);
widget.googleMap.map.setZoom(11);
} else {
widget.googleMap.map.setCenter(widget.points[districtID][0]);
widget.googleMap.map.setZoom(14);
}
}
};
BCMapGridList.prototype = new BCKList();
BCMapGridList.prototype.constructor = BCMapGridList;
function BCMapGridList(parent) {
if (parent != null) {
BCKList.call(this, parent);
this.perPage = 8;
this.addQueryListener(BCMapGridList.changeRegion, [ '/region/*' ]);
this.isPaginated = true;
}
}
BCMapGridList.prototype.load = function() {
if (this.getQuery()) {
var regionID = this.getQuery().split('/')[2];
this.data.feServiceArgs = {
config : {
'regionID' : regionID,
'stateID' : this.data.config.stateID,
'categoryID' : this.data.config.categoryID
}
};
}
KList.prototype.load.call(this);
};
BCMapGridList.changeRegion = function(widget, query) {
if (widget.activated()) {
widget.refresh();
}
};
BCMapGridList.prototype.onShow = function() {
if (!this.getQuery() || !this.getQuery().split('/')[2]) {
KBreadcrumb.dispatchURL({
query : '/region/23'
});
} else {
BCKList.prototype.onShow.call(this);
}
};
BCMapGridList.prototype.onLoad = function(data) {
this.data.items = data.items;
this.setTotalPages(this.totalPages, true);
var bcMapWidget = this.parent.childWidget('/widget-map');
var googleMap = bcMapWidget.googleMap;
if (this.getQuery() != null && googleMap) {
var coordinate = null;
var regionID = this.getQuery().split('/')[2];
if (!bcMapWidget.points[regionID]) {
bcMapWidget.points[regionID] = [];
}
for ( var index in this.data.items) {
if (bcMapWidget.pointsAddedToMap[this.data.items[index].coordinate] == null) {
eval('coordinate = new google.maps.LatLng(' + this.data.items[index].coordinate + ');');
var mapPoint = new Object();
mapPoint.coordinate = this.data.items[index].coordinate;
mapPoint.local = '';
mapPoint.city = '';
mapPoint.address = '';
if (this.data.items[index].designation)
mapPoint.designation = this.data.items[index].designation;
else
mapPoint.designation = '';
googleMap.placeMarker(coordinate, false, false, mapPoint);
bcMapWidget.points[regionID].push(coordinate);
bcMapWidget.pointsAddedToMap[this.data.items[index].coordinate] = true;
}
}
if (bcMapWidget.points[regionID] != null && bcMapWidget.points[regionID].length == 1) {
bcMapWidget.googleMap.map.setCenter(bcMapWidget.points[regionID][0]);
bcMapWidget.googleMap.map.setZoom(14);
}
}
this.draw();
};
BCMapGridList.prototype.draw = function() {
var translations = this.getParent('KPage').getTranslation(this.className);
// se nao houver mais do que uma página, esconder a paginação
if (this.data.pageCount <= 1) {
this.setStyle({
display : 'none'
}, KWidget.PAGINATION_DIV);
}
if (this.data.items && this.data.items.length > 0) {
var count = 0;
for ( var index in this.data.items) {
if (count % 3 == 0) {
var gridPanel = new KPanel(this);
gridPanel.hash = '/panel-' + count;
this.appendChild(gridPanel);
}
var item = new KText(gridPanel);
item.setTitle(this.data.items[index].name);
item.appendTitleText('
' + this.data.items[index].address + '', true);
if (this.data.items[index].telephone) {
item.appendText('
' + translations.telephone + ' ' + this.data.items[index].telephone);
}
if (this.data.items[index].fax) {
item.appendText('
' + translations.fax + ' ' + this.data.items[index].fax);
}
if (this.data.items[index].schedule) {
item.appendText('
' + translations.schedule + ' ' + this.data.items[index].schedule);
}
item.data.id = this.data.items[index].locationID;
item.data.coordinate = this.data.items[index].coordinate;
item.addEventListener('click', function(e) {
var widget = KSystem.getEventWidget(e);
eval('coordinate = new google.maps.LatLng(' + widget.data.coordinate + ');');
var mapWidget = widget.parent.parent.parent.childWidget('/widget-map');
mapWidget.googleMap.map.setCenter(coordinate);
mapWidget.googleMap.map.setZoom(14);
});
if (count % 3 == 0) {
item.setStyle({
border : 'none'
});
}
item.setStyle({
color : Kinky.site.colors.menuColor1
}, KWidget.TITLE_DIV);
count++;
gridPanel.appendChild(item);
}
}
BCKList.prototype.draw.call(this);
};
BCContestForm.prototype = new KForm();
BCContestForm.prototype.constructor = BCContestForm;
function BCContestForm(parent) {
if (parent != null) {
KForm.call(this, parent);
this.staticForm = true;
this.action = 'php:Game:SubmitParticipation';
this.translations = null;
}
}
BCContestForm.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
if (this.data.game && this.data.game.teaser){
var contestPanel = new KPanel(this);
contestPanel.setTitle(this.translations.answerTitle);
contestPanel.setStyle({
color : Kinky.site.colors.titleColor1
}, KWidget.TITLE_DIV);
var contestQuestion = new KText(contestPanel);
contestQuestion.addCSSClass('ContestQuestion');
contestQuestion.setText(this.data.game.teaser);
contestPanel.appendChild(contestQuestion);
var contestMessage = new KInput(contestPanel, 'textarea', this.translations.answer, 'participationAnswer');
contestMessage.addCSSClass('MessageInput');
contestMessage.setStyle({
labelPosition : 'inside'
});
contestMessage.addValidator(/.+/, '');
contestPanel.appendChild(contestMessage);
this.addInput(contestMessage);
this.appendChild(contestPanel);
var dataPanel = new KPanel(this);
dataPanel.setTitle(this.translations.dataTitle);
dataPanel.setStyle({
color : Kinky.site.colors.titleColor1
}, KWidget.TITLE_DIV);
{
var contestName = new KInput(dataPanel, 'text', this.translations.name, 'participationName');
contestName.addCSSClass('TextInput');
contestName.setStyle({
labelPosition : 'inside'
});
contestName.addValidator(/.+/, '');
dataPanel.appendChild(contestName);
this.addInput(contestName);
var contestEmail = new KInput(dataPanel, 'text', this.translations.email, 'participationEmail');
contestEmail.addCSSClass('TextInput');
contestEmail.setStyle({
labelPosition : 'inside'
});
contestEmail.addValidator(/.+/, '');
dataPanel.appendChild(contestEmail);
this.addInput(contestEmail);
var contestPhone = new KInput(dataPanel, 'text', this.translations.phone, 'participationPhone');
contestPhone.addCSSClass('TextInput');
contestPhone.setStyle({
labelPosition : 'inside'
});
contestPhone.addValidator(/.+/, '');
dataPanel.appendChild(contestPhone);
this.addInput(contestPhone);
var biocolCheck = new KCheckBox(dataPanel, '', 'biocolCheck', true);
biocolCheck.addOption(true, this.translations.biocolNewsletter, false, false);
dataPanel.appendChild(biocolCheck);
this.addInput(biocolCheck);
var termsCheck = new KCheckBox(dataPanel, '', 'termsCheck', true);
termsCheck.addOption(true, this.translations.termsText, false, false);
termsCheck.addValidator(/.+/, '');
dataPanel.appendChild(termsCheck);
this.addInput(termsCheck);
var submitButton = new BCButton(dataPanel, this.translations.submit, 'submit');
dataPanel.appendChild(submitButton);
this.addInput(submitButton);
}
this.appendChild(dataPanel);
}else{
var noActiveContest = new KText(this);
noActiveContest.setText('N\u00e3o existem passatempos activos');
this.appendChild(noActiveContest);
}
KForm.prototype.draw.call(this);
};
BCContestForm.prototype.onValidate = function(text, params, status) {
if (status) {
params.gameID = this.data.game.gameID;
return params;
} else {
var first = true;
for ( var element in params) {
var input = params[element].getInput();
if (first) {
first = false;
input.focus();
}
input.style.color = 'red';
}
return false;
}
};
BCContestForm.prototype.onSuccess = function(data) {
BCMicroSite.dialogWindow.params.type = 0;
KDialog.show(BCMicroSite.dialogWindow, {
content : (data.errorCode == 1 ? this.translations.successText : this.translations.errorText ),
title : (data.errorCode == 1 ? this.translations.successTitle : this.translations.errorTitle )
});
if (data.errorCode != 1){
BCMicroSite.dialogWindow.widgetTitle.childNodes[0].style.color = '#EF4048';
}
};
BCContestPagesMenu.prototype = new KIndex();
BCContestPagesMenu.prototype.constructor = BCContestPagesMenu;
function BCContestPagesMenu(parent) {
if (parent != null) {
KIndex.call(this, parent, 'pageMenu');
this.addLocationListener(BCContestPagesMenu.changeContext, ['/passatempo/*']);
this.setStyle({
display : 'none'
});
BCContestPagesMenu.firstPage = true;
}
}
BCContestPagesMenu.prototype.load = function() {
if (this.activated()) {
this.draw();
}
else {
this.activate();
}
};
BCContestPagesMenu.prototype.draw = function() {
var parentPage = Kinky.site.childWidget('/passatempo');
if (parentPage && parentPage.data && parentPage.data.pages) {
var pageData = new Object();
pageData.pages = parentPage.data.pages;
this.loadIndex(pageData);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.markIndex(this.getHash());
}
this.activate();
};
BCContestPagesMenu.prototype.loadIndex = function(page, level, topUL, parent) {
var subMenuColor1 = Kinky.site.colors.subMenuColor1;
var subMenuColor2 = Kinky.site.colors.subMenuColor2;
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
}
else {
if (level == 1) {
if (!BCContestPagesMenu.firstPage){
var div = window.document.createElement('div');
div.className = 'MenuDivision';
topUL.appendChild(div);
}else{
BCContestPagesMenu.firstPage = false;
}
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
}
catch (e) {
dump(parent, false, true);
}
var a = window.document.createElement('a');
a.style.color = subMenuColor2;
if (page.graphicStyle && page.graphicStyle.textImages && page.graphicStyle.textImages.pageMenuTitle) {
a.appendChild(KCSS.img(page.graphicStyle.textImages.pageMenuTitle.base, page.menuText, page.titleText));
}
else {
a.appendChild(window.document.createTextNode(page.menuText));
}
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
this.subIndex[page.urlHashText] = li;
li.appendChild(a);
topUL.appendChild(li);
}
}
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page);
}
};
BCContestPagesMenu.prototype.markIndex = function(hash) {
if (!hash) { return; }
var paths = hash.split('/');
paths.splice(0, 1);
for ( var level in this.lastMarked) {
this.removeCSSClass('KIndexMarked', this.lastMarked[level]);
this.lastMarked[level].childNodes[0].style.color = Kinky.site.colors.subMenuColor2;
}
this.lastMarked = {};
var subHash = '';
for ( var path in paths) {
subHash += '/' + paths[path];
if (!this.subIndex[subHash]) {
continue;
}
this.lastMarked[this.subIndex[subHash].name] = this.subIndex[subHash];
this.addCSSClass('KIndexMarked', this.subIndex[subHash]);
this.subIndex[subHash].childNodes[0].style.color = Kinky.site.colors.subMenuColor1;
}
};
BCContestPagesMenu.changeContext = function(widget, hash) {
if (!(Kinky.site.childWidget(hash) instanceof KPageDialog)){
if (!/passatempo/.test(hash)){
widget.setStyle({
display : 'none'
});
return;
}
widget.setStyle({
display : 'block'
});
widget.refresh();
}
};
BCContestWinnersList.prototype = new KPanel();
BCContestWinnersList.prototype.constructor = BCContestWinnersList;
function BCContestWinnersList(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
this.translations = null;
}
}
BCContestWinnersList.prototype.onLoad = function(data){
if (data.winners){
this.data.winners = {};
KSystem.merge(this.data.winners, data.winners);
}
this.draw();
};
BCContestWinnersList.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
if (this.data.winners){
var titles = new KText(this, false, null, 'result');
titles.addCSSClass('Title');
titles.setTitle(this.translations.winnerName);
titles.setText(this.translations.winnerText);
this.appendChild(titles);
titles.setStyle({
color : Kinky.site.colors.titleColor1
});
for(var index in this.data.winners){
var result = new KText(this);
result.setStyle({
color : Kinky.site.colors.subMenuColor2
});
result.addCSSClass('Winner');
var i = 0;
var countHeight = 0;
while (this.data.winners[index].answer.length > i){
i = i + 95;
countHeight++;
}
result.setText('
' + this.data.winners[index].name + '
' + this.data.winners[index].answer + '
');
var bottomBorder = window.document.createElement('div');
bottomBorder.className = 'BottomBorder';
result.childDiv(KWidget.CONTAINER_DIV).appendChild(bottomBorder);
this.appendChild(result);
}
}
KPanel.prototype.draw.call(this);
};
BCLeftPanel.prototype = new KPanel();
BCLeftPanel.prototype.constructor = BCLeftPanel;
function BCLeftPanel(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.hash = '/left-panel';
this.addLocationListener(BCLeftPanel.toggleLeftPanel, [ BCMicroSite.productPageHash + '/*', '/area-profissional' ]);
this.effects = {
enter : {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : BCPage.FADE_DURATION,
go : {
alpha : 1
},
from : {
alpha : 0
}
}
};
}
}
BCLeftPanel.prototype.draw = function() {
var products = Kinky.site.childWidget(BCMicroSite.productPageHash);
if (products && products.data && products.data.pages) {
var pageData = new Object();
pageData.pages = products.data.pages;
productMenu = new BCLeftPanelProductsMenu(this, pageData);
this.appendChild(productMenu, null, KWidget.CONTENT_DIV);
}
var productHighlights = new BCProductHighlight(this);
this.appendChild(productHighlights);
KPanel.prototype.draw.call(this);
};
BCLeftPanel.toggleLeftPanel = function(widget, hash) {
if (!(Kinky.site.childWidget(hash) instanceof KPageDialog)) {
var reg_exp = new RegExp(BCMicroSite.productPageHash);
if (reg_exp.test(hash) || /area\-profissional/.test(hash)) {
if(widget.loadedChildren == 0) {
widget.setStyle({
display : 'block',
opacity : '0'
});
widget.showContext();
}
} else {
if(widget.loadedChildren != 0) {
widget.setStyle({
display : 'none',
opacity : '0'
});
widget.hideContext();
}
}
}
};
BCLeftPanelProductsMenu.prototype = new KIndex();
BCLeftPanelProductsMenu.prototype.constructor = BCLeftPanelProductsMenu;
function BCLeftPanelProductsMenu(parent, pageData) {
if (parent != null) {
KIndex.call(this, parent, 'productMenu', pageData);
}
}
BCLeftPanelProductsMenu.prototype.draw = function() {
KIndex.prototype.draw.call(this);
this.markIndex(this.getHash());
};
BCLeftPanelProductsMenu.prototype.loadIndex = function(page, level, topUL, parent) {
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
} else {
if (level == 1) {
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
} catch (e) {
dump(parent, false, true);
}
li.appendChild(new BCLeftPanelProductsMenuItem(li, page.menuText, page.urlHashText).childDiv(KWidget.ROOT_DIV));
this.subIndex[page.urlHashText] = li;
topUL.appendChild(li);
}
}
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page);
}
};
BCLeftPanelProductsMenu.prototype.setMarked = function(hash) {
if (this.activated()) {
this.markIndex(hash);
}
};
BCLeftPanelProductsMenu.prototype.markIndex = function(hash) {
var level = 1;
if (this.lastMarked[level] != null && this.lastMarked[level] != this.subIndex[hash]) {
var target = KSystem.getWidget(this.lastMarked[level].childNodes[0]);
target.setActive(false);
}
KIndex.prototype.markIndex.call(this, hash);
if (this.lastMarked[level] != null) {
var target = KSystem.getWidget(this.lastMarked[level].childNodes[0]);
target.setActive(true);
}
};
BCLeftPanelProductsMenuItem.prototype = new KWidget();
BCLeftPanelProductsMenuItem.prototype.constructor = BCLeftPanelProductsMenuItem;
function BCLeftPanelProductsMenuItem(parent, label, urlHashText) {
if (parent != null) {
KWidget.call(this, parent);
this.backgroundContainer = window.document.createElement('div');
this.backgroundContainer.className = 'BCLeftPanelProductsMenuItemBackgroundContainer';
this.backgroundHoverContainer = window.document.createElement('div');
this.backgroundHoverContainer.className = 'BCLeftPanelProductsMenuItemBackgroundHoverContainer';
this.backgroundActiveContainer = window.document.createElement('div');
this.backgroundActiveContainer.className = 'BCLeftPanelProductsMenuItemBackgroundActiveContainer';
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.backgroundContainer);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.backgroundHoverContainer);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.backgroundActiveContainer);
var topDiv = window.document.createElement('div');
topDiv.className = 'BCLeftPanelProductsMenuItemBackgroundTop';
topDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
topDiv.style.backgroundRepeat = 'no-repeat';
var middleDiv = window.document.createElement('div');
middleDiv.className = 'BCLeftPanelProductsMenuItemBackgroundMiddle';
middleDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
middleDiv.style.backgroundRepeat = 'no-repeat';
var bottomDiv = window.document.createElement('div');
bottomDiv.className = 'BCLeftPanelProductsMenuItemBackgroundBottom';
bottomDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
bottomDiv.style.backgroundRepeat = 'no-repeat';
this.backgroundContainer.appendChild(topDiv);
this.backgroundContainer.appendChild(middleDiv);
this.backgroundContainer.appendChild(bottomDiv);
var topDiv = window.document.createElement('div');
topDiv.className = 'BCLeftPanelProductsMenuItemBackgroundTop';
topDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
topDiv.style.backgroundRepeat = 'no-repeat';
var middleDiv = window.document.createElement('div');
middleDiv.className = 'BCLeftPanelProductsMenuItemBackgroundMiddle';
middleDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
middleDiv.style.backgroundRepeat = 'no-repeat';
var bottomDiv = window.document.createElement('div');
bottomDiv.className = 'BCLeftPanelProductsMenuItemBackgroundBottom';
bottomDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
bottomDiv.style.backgroundRepeat = 'no-repeat';
this.backgroundHoverContainer.appendChild(topDiv);
this.backgroundHoverContainer.appendChild(middleDiv);
this.backgroundHoverContainer.appendChild(bottomDiv);
var topDiv = window.document.createElement('div');
topDiv.className = 'BCLeftPanelProductsMenuItemBackgroundTop';
topDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
topDiv.style.backgroundRepeat = 'no-repeat';
var middleDiv = window.document.createElement('div');
middleDiv.className = 'BCLeftPanelProductsMenuItemBackgroundMiddle';
middleDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
middleDiv.style.backgroundRepeat = 'no-repeat';
var bottomDiv = window.document.createElement('div');
bottomDiv.className = 'BCLeftPanelProductsMenuItemBackgroundBottom';
bottomDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
bottomDiv.style.backgroundRepeat = 'no-repeat';
this.backgroundActiveContainer.appendChild(topDiv);
this.backgroundActiveContainer.appendChild(middleDiv);
this.backgroundActiveContainer.appendChild(bottomDiv);
this.a = window.document.createElement('a');
this.a.appendChild(window.document.createTextNode(label));
this.a.href = (/http:/.test(urlHashText) ? '' : '#') + urlHashText;
this.link = urlHashText;
this.childDiv(KWidget.CONTENT_DIV).appendChild(this.a);
this.setStyle({
fontSize : '16px'
}, this.a);
if (KBrowserDetect.browser != 2) {
this.setStyle({
opacity : (Kinky.BASE_VERSION == '/biocolkids' ? '0.6' : '0')
}, this.backgroundHoverContainer);
this.setStyle({
opacity : '0'
}, this.backgroundActiveContainer);
} else {
this.setStyle({
display : 'none'
}, this.backgroundHoverContainer);
this.setStyle({
display : 'none'
}, this.backgroundActiveContainer);
}
KSystem.addEventListener(this.panel, 'click', BCLeftPanelProductsMenuItem.onClick);
KSystem.addEventListener(this.panel, 'mouseover', BCLeftPanelProductsMenuItem.onMouseOver);
KSystem.addEventListener(this.panel, 'mouseout', BCLeftPanelProductsMenuItem.onMouseOut);
this.currentState = false;
}
}
BCLeftPanelProductsMenuItem.prototype.setActive = function(state) {
if (state && !this.currentState) {
if (KBrowserDetect.browser != 2) {
KEffects.addEffect(this.backgroundActiveContainer, {
f : KEffects.easeOutExpo,
type : 'fade',
realAlpha : true,
duration : 750,
go : {
alpha : 1
},
from : {
alpha : 0
}
});
KEffects.addEffect(this.a, {
f : KEffects.easeOutExpo,
type : 'font-resize',
unit : 'px',
duration : 750,
go : {
fontSize : 20
},
from : {
fontSize : 16
}
});
} else {
this.setStyle({
fontSize : '20px'
}, this.a);
this.setStyle({
display : 'block'
}, this.backgroundActiveContainer);
}
this.currentState = true;
} else if (!state && this.currentState) {
if (KBrowserDetect.browser != 2) {
KEffects.addEffect(this.backgroundActiveContainer, {
f : KEffects.easeOutExpo,
type : 'fade',
realAlpha : true,
duration : 750,
go : {
alpha : 0
},
from : {
alpha : 1
}
});
KEffects.addEffect(this.a, {
f : KEffects.easeOutExpo,
type : 'font-resize',
unit : 'px',
duration : 750,
go : {
fontSize : 16
},
from : {
fontSize : 20
}
});
} else {
this.setStyle({
fontSize : '16px'
}, this.a);
this.setStyle({
display : 'none'
}, this.backgroundActiveContainer);
}
this.currentState = false;
}
};
BCLeftPanelProductsMenuItem.onClick = function(e) {
var el = KSystem.getEventTarget(e);
var widget = (el instanceof KWidget ? el : KSystem.getWidget(el));
KBreadcrumb.dispatchURL({
hash : widget.link
});
};
BCLeftPanelProductsMenuItem.onMouseOver = function(e) {
var el = KSystem.getEventTarget(e);
var widget = (el instanceof KWidget ? el : KSystem.getWidget(el));
if (!this.currentState) {
if (KBrowserDetect.browser != 2) {
KEffects.addEffect(widget.backgroundHoverContainer, {
f : KEffects.easeOutExpo,
type : 'fade',
realAlpha : true,
duration : 750,
go : {
alpha : 1
},
from : {
alpha : (Kinky.BASE_VERSION == '/biocolkids' ? 0.6 : 0)
}
});
} else {
widget.setStyle({
display : 'block'
}, widget.backgroundHoverContainer);
}
}
};
BCLeftPanelProductsMenuItem.onMouseOut = function(e) {
var el = KSystem.getEventTarget(e);
var widget = (el instanceof KWidget ? el : KSystem.getWidget(el));
if (!this.currentState) {
if (KBrowserDetect.browser != 2) {
KEffects.addEffect(widget.backgroundHoverContainer, {
f : KEffects.easeOutExpo,
type : 'fade',
realAlpha : true,
duration : 750,
go : {
alpha : (Kinky.BASE_VERSION == '/biocolkids' ? 0.6 : 0)
},
from : {
alpha : 1
}
});
} else {
widget.setStyle({
display : 'none'
}, widget.backgroundHoverContainer);
}
}
};
BCProductPagesMenu.prototype = new KIndex();
BCProductPagesMenu.prototype.constructor = BCProductPagesMenu;
function BCProductPagesMenu(parent) {
if (parent != null) {
KIndex.call(this, parent, 'pageMenu');
this.addLocationListener(BCProductPagesMenu.changeContext, [ BCMicroSite.productPageHash + '/*' ]);
var styles = {
display : 'none',
opacity : '0'
};
if (Kinky.BASE_VERSION == '/biocolkids'){
styles.background = 'url("images/microsite/kids_product_menu_bk.png")';
styles.height = '80px';
};
this.setStyle(styles);
this.effects = {
enter : {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : BCPage.FADE_DURATION,
go : {
alpha : 1
},
from : {
alpha : 0
}
}
};
BCProductPagesMenu.firstPage = true;
}
}
BCProductPagesMenu.prototype.load = function() {
this.draw();
};
BCProductPagesMenu.prototype.draw = function() {
this.currentProduct = this.getHash().split('/');
var parentPage = Kinky.site.childWidget(BCMicroSite.productPageHash + '/' + this.getHash().split('/')[2]);
if (parentPage && parentPage.data && parentPage.data.pages) {
var pageData = new Object();
pageData.pages = parentPage.data.pages;
this.loadIndex(pageData);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.lastMarked = {};
this.activate();
this.markIndex(this.getHash());
}
};
BCProductPagesMenu.prototype.loadIndex = function(page, level, topUL, parent) {
var subMenuColor1 = Kinky.site.colors.subMenuColor1;
var subMenuColor2 = Kinky.site.colors.subMenuColor2;
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
} else {
if (level == 1) {
if (!BCProductPagesMenu.firstPage) {
var div = window.document.createElement('div');
div.className = 'MenuDivision';
topUL.appendChild(div);
} else {
BCProductPagesMenu.firstPage = false;
}
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
} catch (e) {
dump(parent, false, true);
}
var a = window.document.createElement('a');
a.style.color = subMenuColor2;
if (page.graphicStyle && page.graphicStyle.textImages && page.graphicStyle.textImages.pageMenuTitle) {
a.appendChild(KCSS.img(page.graphicStyle.textImages.pageMenuTitle.base, page.menuText, page.titleText));
} else {
a.appendChild(window.document.createTextNode(page.menuText));
}
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
this.subIndex[page.urlHashText] = li;
li.appendChild(a);
KSystem.addEventListener(a, 'mouseover', function(event) {
var target = a;
if (target.parentNode.alt != 1) {
KEffects.addEffect(target, {
f : KEffects.easeOutExpo,
type : 'rgb',
duration : 450,
go : {
rgb : subMenuColor1
}
});
}
});
KSystem.addEventListener(a, 'mouseout', function(event) {
var target = a;
if (target.parentNode.alt != 1) {
KEffects.addEffect(target, {
f : KEffects.easeOutExpo,
type : 'rgb',
duration : 450,
go : {
rgb : subMenuColor2
}
});
}
});
topUL.appendChild(li);
}
}
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page);
}
};
BCProductPagesMenu.prototype.markIndex = function(hash) {
var changedProduct = this.checkContext(hash);
if (!changedProduct) {
var level = 1;
var subMenuColor1 = Kinky.site.colors.subMenuColor1;
var subMenuColor2 = Kinky.site.colors.subMenuColor2;
if (this.lastMarked[level] != null && this.lastMarked[level] != this.subIndex[hash]) {
this.lastMarked[level].alt = 0;
var target = this.lastMarked[level].childNodes[0];
KEffects.addEffect(target, {
f : KEffects.easeOutExpo,
type : 'rgb',
duration : 450,
go : {
rgb : subMenuColor2
}
});
}
KIndex.prototype.markIndex.call(this, hash);
if (this.lastMarked[level] != null) {
this.lastMarked[level].alt = 1;
var target = this.lastMarked[level].childNodes[0];
KEffects.addEffect(target, {
f : KEffects.easeOutExpo,
type : 'rgb',
duration : 450,
go : {
rgb : subMenuColor1
}
});
}
}
};
BCProductPagesMenu.prototype.checkContext = function(hash) {
var changedProduct = false;
if (this.currentProduct) {
var parts = this.getHash().split('/');
for ( var index = 0; index != 3; index++) {
if (index < this.currentProduct.length && parts[index] == this.currentProduct[index]) {
continue;
}
changedProduct = true;
break;
}
} else {
changedProduct = true;
}
return changedProduct;
};
BCProductPagesMenu.changeContext = function(widget, hash) {
if (!(Kinky.site.childWidget(hash) instanceof KPageDialog)) {
var reg_exp = new RegExp(BCMicroSite.productPageHash);
if (!reg_exp.test(hash)) {
widget.setStyle({
display : 'none',
opacity : '0'
});
widget.hideContext();
return;
}
var changedProduct = widget.checkContext(hash);
if (changedProduct) {
widget.setStyle({
display : 'block',
opacity : '0'
});
widget.showContext();
widget.refresh();
}
}
};
BCLangCombo.prototype = new KCombo();
BCLangCombo.prototype.constructor = BCLangCombo;
function BCLangCombo(parent) {
if (parent != null) {
KCombo.call(this, parent, '', 'langSelect', true);
this.staticInput = false;
}
}
BCLangCombo.prototype.load = function() {
if (!this.data)
this.data = {};
this.data.contentView = 'TemplateBlock(templateHandler)';
this.data.contentID = 'Page:language.list.block.php';
this.data.feService = 'php:Frontend:GetBlock';
this.data.feServiceArgs = {
args : {
versionCode : Kinky.BASE_VERSION
}
};
KInput.prototype.load.call(this);
};
BCLangCombo.prototype.onLoad = function(data) {
KSystem.merge(this.data, data);
this.draw();
};
BCLangCombo.prototype.draw = function() {
if (this.data.languageList && this.data.languageList.length > 0) {
this.onShow = function() {
this.setStyle( {
display : this.data.languageList.length > 1 ? 'block' : 'none'
});
};
var currentLanguage = Kinky.getCurrentLanguage();
var selectedLanguage = window.document.createElement('div');
selectedLanguage.className = 'SelectedLanguage';
selectedLanguage.innerHTML = '

' + currentLanguage.toUpperCase() + '
';
selectedLanguage.id = 'selected-language';
this.childDiv().appendChild(selectedLanguage);
this.addEventListener('click', function(event) {
var widget = KSystem.getEventWidget(event);
KCombo.toggleOptions(event, widget);
if (widget.optionsToggled == true) {
widget.setStyle( {
backgroundPosition : '-64px 0px'
});
} else {
widget.setStyle( {
backgroundPosition : '0px 0px'
});
}
});
for ( var index in this.data.languageList) {
var language = this.data.languageList[index];
if(language != currentLanguage)
this.addOption(language, '

' + language.toUpperCase() + '
', false, true);
}
KCombo.prototype.draw.call(this);
var opcoes = this.optionsContent.getElementsByTagName('div');
for ( var i = 0; i != opcoes.length; i++) {
if (/KComboOption/.test(opcoes[i].className)) {
KSystem.removeEventListener(opcoes[i], 'click', KCombo.selectOption);
KSystem.addEventListener(opcoes[i], 'click', this.selectOption);
}
}
}
};
BCLangCombo.prototype.selectOption = function(event, element, widget, noChange) {
if (!element) {
element = KSystem.getEventTarget(event);
widget = KCombo.getEventWidget(event);
}
element = KCombo.getLabel(element);
if (element.alt != null && element.alt != '') {
widget.selectedOption.value = element.alt;
// widget.selectedOptionText.value =
// HTML.stripTags(HTMLEntities.decode(element.innerHTML));
document.getElementById('selected-language').innerHTML = '

' + element.alt.toUpperCase() + '
';
window.location = Kinky.SITE_URL + element.alt + '/';
}
/*
* else { widget.selectedOption.value = ''; widget.selectedOptionText.value =
* ''; }
*/
if (!noChange) {
KSystem.fireEvent(widget.selectedOption, 'change');
KSystem.fireEvent(widget.selectedOptionText, 'change');
KSystem.fireEvent(widget.panel, 'change');
}
};
BCButton.prototype = new KInput();
BCButton.prototype.constructor = BCButton;
function BCButton(parent, label, id) {
if (parent != null) {
this.simpleWidget = false;
KInput.call(this, parent, 'submit', label, id, false);
this.addCSSClass('KInput');
this.leftDiv = window.document.createElement('div');
this.leftDiv.className = 'BCButtonLeft';
this.middleDiv = window.document.createElement('div');
this.middleDiv.className = 'BCButtonMiddle';
this.rightDiv = window.document.createElement('div');
this.rightDiv.className = 'BCButtonRight';
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.leftDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.middleDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.rightDiv);
this.leftDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
this.leftDiv.style.backgroundRepeat = 'no-repeat';
this.middleDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
this.middleDiv.style.backgroundRepeat = 'no-repeat';
this.rightDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
this.rightDiv.style.backgroundRepeat = 'no-repeat';
}
}
BCButton.prototype.draw = function() {
KInput.prototype.draw.call(this);
//this.middleDiv.appendChild(this.inputContainer);
}
BCContactRichtext.prototype = new KText();
BCContactRichtext.prototype.constructor = BCContactRichtext;
function BCContactRichtext(parent) {
if (parent != null) {
KText.call(this, parent);
}
}
BCContactRichtext.prototype.draw = function() {
this.hash = '/richtext/' + this.data.name;
if (this.data.config && this.data.config.html){
this.setText(this.data.config.html);
}
KText.prototype.draw.call(this);
if (!(this.data.config && this.data.config.html)){
this.setStyle({
display : 'none'
});
}
};
BCContinent.prototype = new KImage();
BCContinent.prototype.constructor = BCContinent;
function BCContinent(parent, image) {
if (parent != null) {
KImage.call(this, parent, image);
}
}
BCContinent.prototype.draw = function() {
KImage.prototype.draw.call(this);
}
BCDownloadList.prototype = new KPanel();
BCDownloadList.prototype.constructor = BCDownloadList;
function BCDownloadList(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
}
}
BCDownloadList.prototype.draw = function() {
if (this.data.galleryItems.length > 0) {
for ( var index in this.data.galleryItems) {
var itemInfo = this.data.galleryItems[index];
if (itemInfo.internalFilename && itemInfo.internalFilename != '') {
var itemPanel = new KPanel(this);
itemPanel.addCSSClass('ItemPanel');
var itemText = new KText(itemPanel);
itemText.addCSSClass('ItemText');
itemText.setText(itemInfo.fileTitle);
if (itemInfo.iconFilename && itemInfo.iconFilename != '') {
var itemImage = new KImage(itemPanel, itemInfo.fileIconPath);
itemImage.addCSSClass('ItemImage');
itemPanel.appendChild(itemImage);
itemText.setStyle({
width: '155px',
paddingTop: '10px'
});
} else {
itemText.setStyle({
width: '223px'
});
}
itemPanel.appendChild(itemText);
var itemFile = new KLink(itemPanel, itemInfo.fileInternalPath, null, '_blank');
itemFile.setLinkText(itemInfo.internalFilename);
itemFile.addCSSClass('ItemFile');
if (Kinky.site.colors && Kinky.site.colors.textColor) {
itemText.setStyle({
color: Kinky.site.colors.textColor
});
itemFile.setStyle({
color: Kinky.site.colors.textColor
}, KLink.LINK_ELEMENT);
}
itemPanel.appendChild(itemFile);
if (itemInfo.downloadIcon && itemInfo.downloadIcon != '') {
itemFile.setStyle({
width: '157px'
});
var itemIcon = new KImage(this, itemInfo.downloadIcon);
itemIcon.addCSSClass('ItemIcon');
itemPanel.appendChild(itemIcon);
if (itemInfo.iconFilename && itemInfo.iconFilename != '') {
itemFile.setStyle({
paddingTop: '10px'
});
itemIcon.setStyle({
paddingTop: '10px'
});
}
} else {
itemFile.setStyle({
width: '177px'
});
}
var bottomBorder = window.document.createElement('div');
bottomBorder.className = 'BottomBorder';
itemPanel.childDiv(KWidget.CONTAINER_DIV).appendChild(bottomBorder);
this.appendChild(itemPanel);
}
}
}
KPanel.prototype.draw.call(this);
}
BCFile.prototype = new KFile();
BCFile.prototype.constructor = BCFile;
function BCFile(parent, label, id) {
if (parent != null) {
this.simpleWidget = false;
KFile.call(this, parent, label, id);
this.addCSSClass('BCButtonContent', KWidget.CONTENT_DIV);
this.addCSSClass('BCDivBackground', KWidget.BACKGROUND_DIV);
this.leftDiv = window.document.createElement('div');
this.leftDiv.className = 'BCFileLeft BCBackgroundLeft';
this.middleDiv = window.document.createElement('div');
this.middleDiv.className = 'BCFileMiddle BCBackgroundMiddle';
this.rightDiv = window.document.createElement('div');
this.rightDiv.className = 'BCFileRight BCBackgroundRight';
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.leftDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.middleDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.rightDiv);
}
}
BCFile.prototype.draw = function() {
KFile.prototype.draw.call(this);
};
BCGalleryList.prototype = new KPanel();
BCGalleryList.prototype.constructor = BCGalleryList;
function BCGalleryList(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
}
}
BCGalleryList.prototype.draw = function() {
if (this.data.galleryItems.length > 0) {
for ( var index in this.data.galleryItems) {
var itemInfo = this.data.galleryItems[index];
var itemPanel = new KPanel(this);
itemPanel.addCSSClass('ItemPanel');
{
if (itemInfo.fileInternalPath && itemInfo.fileInternalPath != '') {
var itemImage = new KImage(itemPanel, itemInfo.fileInternalPath);
itemImage.addCSSClass('ItemImage');
itemPanel.appendChild(itemImage);
}
var itemText = new KText(itemPanel);
itemText.addCSSClass('ItemText');
itemText.setText(itemInfo.fileDescription);
itemPanel.appendChild(itemText);
}
this.appendChild(itemPanel);
}
}
KPanel.prototype.draw.call(this);
}
BCGridList.prototype = new KList();
BCGridList.prototype.constructor = BCGridList;
function BCGridList(parent) {
if (parent != null) {
KList.call(this, parent);
this.perPage = 30;
this.isPaginated = false;
}
}
BCGridList.prototype.onLoad = function(data) {
if (!this.data){
this.data = {};
}
KSystem.merge(this.data, data);
this.draw();
}
BCGridList.prototype.draw = function() {
if (this.data.itemList && this.data.itemList.length > 0) {
var count = 0;
var total = this.data.itemList.length;
for ( var index in this.data.itemList) {
if (count % 2 == 0){
var gridPanel = new KPanel(this);
gridPanel.hash = '/panel-' + count;
if (total % 2 != 0 && (count + 1) == total){
gridPanel.setStyle({
backgroundImage : 'url(images/microsite/dicas_half_box.png)'
});
}
this.appendChild(gridPanel);
}
var gridItem = new KText(gridPanel);
gridItem.setTitle(this.data.itemList[index].title);
gridItem.setText(this.data.itemList[index].text);
gridItem.setStyle({
background : 'url(' + this.data.itemList[index].image + ') no-repeat'
});
if (count % 2 == 0){
gridItem.setStyle({
marginRight : '60px'
});
}
count++;
gridPanel.appendChild(gridItem);
}
}
KList.prototype.draw.call(this);
}
BCHomepageHighlights.prototype = new KPanel();
BCHomepageHighlights.prototype.constructor = BCHomepageHighlights;
function BCHomepageHighlights(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.selectedHighlight = null;
this.translations = null;
}
}
BCHomepageHighlights.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
this.setTitle(this.translations.highlightTitle);
// var productWizard = new BCWebsiteKButton(this, this.translations.wizardBt, 'wizardBt', null);
// productWizard.addEventListener('click', function() {
// KBreadcrumb.dispatchURL({
// hash : '/wizard'
// });
// });
// this.appendTitleChild(productWizard);
var first = true;
for ( var index in this.data.highlightItems) {
var highlightItem = new KPanel(this);
highlightItem.hash = '/highlight-item/' + index;
var leftBk = window.document.createElement('div');
leftBk.className = 'LeftBk';
highlightItem.widgetTitle.appendChild(leftBk);
var middleBk = window.document.createElement('div');
middleBk.className = 'MiddleBk';
highlightItem.widgetTitle.appendChild(middleBk);
var rightBk = window.document.createElement('div');
rightBk.className = 'RightBk';
highlightItem.widgetTitle.appendChild(rightBk);
var title = window.document.createElement('h1');
title.style.fontSize = '14px';
title.innerHTML = this.data.highlightItems[index].name;
highlightItem.content.appendChild(title);
var highlightLink = new KLink(this, this.data.highlightItems[index].url.indexOf('http://') != -1 ? this.data.highlightItems[index].url : '#' + this.data.highlightItems[index].url, this.data.highlightItems[index].image);
highlightLink.isImageLink = true;
highlightLink.childDiv(KLink.LINK_ELEMENT).setAttribute('target', this.data.highlightItems[index].url.indexOf('http://') != -1 ? '_blank' : '_self');
var lead = this.data.highlightItems[index].lead;
if (this.data.highlightItems[index].lead.length > 155) {
lead = this.data.highlightItems[index].lead.substr(0, 155) + ' (...)';
}
lead += '
' + this.translations.more + ' \u00bb';
highlightLink.setLinkText(lead, true);
highlightItem.appendChild(highlightLink);
var sectionTitle = window.document.createElement('h2');
sectionTitle.innerHTML = this.data.highlightItems[index].subtitle || '';
highlightItem.content.appendChild(sectionTitle);
highlightItem.setStyle({
width : '151px'
});
if (KBrowserDetect.browser != 2) {
highlightItem.setStyle({
opacity : '0'
}, KWidget.BACKGROUND_DIV);
}
else {
highlightItem.setStyle({
display : 'none'
}, KWidget.BACKGROUND_DIV);
}
if (first) {
highlightItem.setStyle({
width : '342px',
marginLeft : '0',
zIndex : '2'
});
if (KBrowserDetect.browser != 2) {
highlightItem.setStyle({
opacity : '1'
}, KWidget.BACKGROUND_DIV);
}
else {
highlightItem.setStyle({
display : 'block'
}, KWidget.BACKGROUND_DIV);
}
this.selectedHighlight = highlightItem.hash;
title.style.fontSize = '22px';
first = false;
}
highlightItem.addEventListener('mouseover', function(e) {
var widget = KSystem.getEventWidget(e, 'KPanel');
if (widget.hash != widget.parent.selectedHighlight) {
var lastWidget = widget.parent.childWidget(widget.parent.selectedHighlight);
if (KBrowserDetect.browser != 2) {
lastWidget.setStyle({
opacity : '0'
}, KWidget.BACKGROUND_DIV);
}
else {
lastWidget.setStyle({
display : 'none'
}, KWidget.BACKGROUND_DIV);
}
lastWidget.setStyle({
zIndex : '1'
});
var widgetTitle = widget.content.getElementsByTagName('h1')[0];
var lastWidgetTitle = lastWidget.content.getElementsByTagName('h1')[0];
KEffects.addEffect(widgetTitle, {
f : KEffects.easeOutExpo,
type : 'font-resize',
unit : 'px',
duration : 300,
go : {
fontSize : 22
}
});
KEffects.addEffect(lastWidgetTitle, {
f : KEffects.easeOutExpo,
type : 'font-resize',
unit : 'px',
duration : 300,
go : {
fontSize : 14
}
});
widget.setStyle({
zIndex : '2'
});
KEffects.addEffect(widget, {
f : KEffects.easeOutExpo,
type : 'resize',
unit : 'px',
duration : 1000,
go : {
width : 342
},
lock : {
height : true
},
onComplete : function(widget, tween) {
if (KBrowserDetect.browser != 2) {
lastWidget.setStyle({
opacity : '0'
}, KWidget.BACKGROUND_DIV);
}
else {
lastWidget.setStyle({
display : 'none'
}, KWidget.BACKGROUND_DIV);
}
if (KBrowserDetect.browser != 2) {
KEffects.addEffect(widget.background, {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : 200,
go : {
alpha : 1
},
from : {
alpha : 0
}
});
}
else {
widget.setStyle({
display : 'block'
}, KWidget.BACKGROUND_DIV);
}
}
});
KEffects.addEffect(lastWidget, {
f : KEffects.easeOutExpo,
type : 'resize',
unit : 'px',
duration : 1000,
go : {
width : 151
},
lock : {
height : true
}
});
widget.parent.selectedHighlight = widget.hash;
}
});
this.appendChild(highlightItem);
}
KPanel.prototype.draw.call(this);
}
BCKButton.prototype = new KButton();
BCKButton.prototype.constructor = BCKButton;
function BCKButton(parent, label, id, callback) {
if (parent != null) {
this.simpleWidget = false;
KButton.call(this, parent, label, id, callback);
this.leftDiv = window.document.createElement('div');
this.leftDiv.className = 'BCKButtonLeft';
this.middleDiv = window.document.createElement('div');
this.middleDiv.className = 'BCKButtonMiddle';
this.rightDiv = window.document.createElement('div');
this.rightDiv.className = 'BCKButtonRight';
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.leftDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.middleDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.rightDiv);
this.leftDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
this.leftDiv.style.backgroundRepeat = 'no-repeat';
this.middleDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
this.middleDiv.style.backgroundRepeat = 'no-repeat';
this.rightDiv.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
this.rightDiv.style.backgroundRepeat = 'no-repeat';
}
}
BCKButton.prototype.draw = function() {
KButton.prototype.draw.call(this);
};
BCList.prototype = new BCKList();
BCList.prototype.constructor = BCList;
function BCList(parent) {
if (parent != null) {
KList.call(this, parent);
this.hash = '/item-list';
/*this.perPage = 2;*/
this.nPage = 0;
this.isPaginated = true;
this.showReadMore = true;
}
}
BCList.prototype.onLoad = function(data) {
if (this.data == null) {
this.data = {};
}
KSystem.merge(this.data, data);
this.draw();
}
BCList.prototype.draw = function() {
var translations = this.getParent('KPage').getTranslation(this.className);
this.totalCount = this.data.pageCount * this.perPage;
// se nao houver mais do que uma página, esconder a paginação
if (this.data.pageCount <= 1) {
this.setStyle({
display: 'none'
}, KWidget.PAGINATION_DIV);
}
if (this.data.itemList.length > 0) {
this.setTotalPages(this.data.pageCount, true);
for ( var index in this.data.itemList) {
var itemInfo = this.data.itemList[index];
var image = (itemInfo.image && itemInfo.image.length) > 0 && itemInfo.image.charAt(itemInfo.image.length-1) != '/' ? itemInfo.image : null;
var itemPanel = new KPanel(this);
itemPanel.addCSSClass('ItemPanel');
{
if (image) {
var itemImage = new KImage(itemPanel, image);
itemImage.addCSSClass('ItemImage');
itemPanel.appendChild(itemImage);
}
var itemText = new KText(itemPanel);
itemText.hash = '/item-text';
itemText.addCSSClass('ItemText');
itemText.setTitle(itemInfo.title);
if (this.showReadMore == true) {
// noticias - mostrar a breve descricao
itemText.setText(itemInfo.introText);
} else {
// dicas - mostrar ja a descricao completa
itemText.setText(itemInfo.text);
}
if (image) {
itemText.addCSSClass('ShortText');
}
if (Kinky.site.colors && Kinky.site.colors.titleColor1) {
itemText.setStyle( {
color : Kinky.site.colors.titleColor1
}, KWidget.TITLE_DIV);
}
if (Kinky.site.colors && Kinky.site.colors.textColor) {
itemText.setStyle( {
color : Kinky.site.colors.textColor
});
}
itemPanel.appendChild(itemText);
if (this.showReadMore == true) {
var readMore = new KText(itemPanel);
readMore.addCSSClass('BtReadMore');
readMore.setText(translations.readMore);
readMore.indice = index;
itemPanel.appendChild(readMore);
// estado inicial
{
readMore.NewsToggled = false;
readMore.setStyle( {
backgroundImage : 'url("' + Kinky.site.theme + '")'
}, [ KWidget.CONTENT_DIV, KWidget.TITLE_DIV ]);
}
var rightBorder = window.document.createElement('div');
rightBorder.className = 'RightBorder';
rightBorder.style.backgroundImage = 'url("' + Kinky.site.theme + '")';
readMore.childDiv(KWidget.CONTAINER_DIV).appendChild(rightBorder);
readMore.addEventListener('mouseover', function(event) {
var widget = KSystem.getEventWidget(event);
if (!widget.NewsToggled) {
widget.addCSSClass('BtReadMoreOver');
}
});
readMore.addEventListener('mouseout', function(event) {
var widget = KSystem.getEventWidget(event);
widget.removeCSSClass('BtReadMoreOver');
});
readMore.addEventListener('click', function(event) {
var widget = KSystem.getEventWidget(event);
var page = widget.getParent('KList');
var textWidget = widget.parent.childWidget('/item-text');
if (!widget.NewsToggled) {
// vamos mostrar o detalhe e mudar o botao
textWidget.setText(page.data.itemList[widget.indice].text);
widget.NewsToggled = true;
widget.setText(translations.close);
widget.addCSSClass('BtReadMoreSelected');
widget.removeCSSClass('BtReadMoreOver');
} else {
textWidget.setText(page.data.itemList[widget.indice].introText);
widget.NewsToggled = false;
widget.setText(translations.readMore);
widget.removeCSSClass('BtReadMoreSelected');
}
});
}
}
this.appendChild(itemPanel);
var bottomBorder = window.document.createElement('div');
bottomBorder.className = 'BottomBorder';
itemPanel.childDiv(KWidget.CONTAINER_DIV).appendChild(bottomBorder);
}
} else {
var noContent = new KText(this);
noContent.addCSSClass('NoContent');
noContent.setText(translations.noContent);
if (Kinky.site.colors && Kinky.site.colors.textColor) {
noContent.setStyle( {
color : Kinky.site.colors.textColor
});
}
this.appendChild(noContent);
}
BCKList.prototype.draw.call(this);
}
BCNewsHighlights.prototype = new KPanel();
BCNewsHighlights.prototype.constructor = BCNewsHighlights;
function BCNewsHighlights(parent) {
if (parent != null) {
KPanel.call(this, parent);
}
}
BCNewsHighlights.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
this.setTitle(this.translations.newsTitle);
var allNewsBt = new BCWebsiteKButton(this, this.translations.seeAll, 'allNewsBt', null);
allNewsBt.addEventListener('click', function() {
KBreadcrumb.dispatchURL({
hash : '/actualidade/noticias'
});
});
this.appendTitleChild(allNewsBt);
if (this.data.itemList.length > 0) {
var first = true;
for ( var index in this.data.itemList) {
var newsItem = new KPanel(this);
{
var newsItemContent = new KLink(newsItem, 'javascript:void(0);', this.data.itemList[index].image);
newsItemContent.setLinkText(this.data.itemList[index].title);
newsItemContent.setStyle({
cursor : 'default'
}, KLink.LINK_ELEMENT);
newsItem.appendChild(newsItemContent);
var text = this.data.itemList[index].introText.length > 60 ? this.data.itemList[index].introText.substr(0, 60) + ' (...)' : this.data.itemList[index].introText;
var textDiv = window.document.createElement('div');
textDiv.className = 'NewsShortDesc';
textDiv.innerHTML = text;
newsItem.content.appendChild(textDiv);
newsItem.clearBoth();
var newsItemBt = new BCWebsiteKButton(newsItem, this.translations.more, 'more', null);
newsItemBt.url = this.data.itemList[index].url;
newsItemBt.indice = this.data.itemList[index].id;
newsItemBt.addEventListener('click', function(e) {
var wid = KSystem.getEventWidget(e);
KBreadcrumb.dispatchURL({
hash : '/actualidade/noticias',
action : '/news/' + wid.indice
});
});
newsItem.appendChild(newsItemBt);
}
if (first) {
newsItem.setStyle({
border : 'none'
});
}
this.appendChild(newsItem);
first = false;
}
}
KPanel.prototype.draw.call(this);
}
BCNewsMarquee.prototype = new KPanel();
BCNewsMarquee.prototype.constructor = BCNewsMarquee;
BCNewsMarquee.rollOverTimer = null;
BCNewsMarquee.Time = 33;
BCNewsMarquee.instance = null;
function BCNewsMarquee(parent) {
if (parent != null) {
KPanel.call(this, parent);
BCNewsMarquee.instance = this;
}
}
BCNewsMarquee.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
this.setTitle(this.translations.newsTitle);
var image = window.document.createElement('img');
image.src = '/images/site/marquee_title_arrow.png';
this.widgetTitle.appendChild(image);
this.div1 = window.document.createElement('div');
this.div1.className = 'MarqueeDiv';
this.div1.style.left = '0px';
this.content.appendChild(this.div1);
if (this.data.highlightItems.length > 0) {
var tamText = 6.5;
var tamDiv = 0;
this.l1 = 0;
this.l2 = 0;
this.div2 = window.document.createElement('div');
this.div2.className = 'MarqueeDiv';
this.div2.style.left = '0px';
this.content.appendChild(this.div2);
for ( var index in this.data.highlightItems) {
var newsItem = new KLink(this, this.data.highlightItems[index].url);
newsItem.setLinkText(this.data.highlightItems[index].name);
this.div1.appendChild(newsItem.panel);
newsItem.go();
newsItem = new KLink(this, this.data.highlightItems[index].url);
newsItem.setLinkText(this.data.highlightItems[index].name);
this.div2.appendChild(newsItem.panel);
newsItem.go();
tamDiv += this.data.highlightItems[index].name.length + 2;
}
tamDiv = (tamDiv * tamText) + 'px';
this.div1.style.width = tamDiv;
this.div2.style.width = tamDiv;
KSystem.addEventListener(this, 'mouseover', function(event) {
clearTimeout(BCNewsMarquee.rollOverTimer);
});
KSystem.addEventListener(this, 'mouseout', function(event) {
if (BCNewsMarquee.instance.data.highlightItems.length > 0) {
BCNewsMarquee.rollOverTimer = setTimeout(BCNewsMarquee.doAutoNext, BCNewsMarquee.Time);
}
});
BCNewsMarquee.rollOverTimer = setTimeout(BCNewsMarquee.doAutoNext, BCNewsMarquee.Time);
} else if (this.data.highlightItems.length == 1) {
var newsItem = new KLink(this, this.data.highlightItems[0].url);
newsItem.setLinkText(this.data.highlightItems[0].name);
this.div1.appendChild(newsItem.panel);
newsItem.go();
}
KPanel.prototype.draw.call(this);
};
BCNewsMarquee.prototype.onShow = function() {
KPanel.prototype.onShow.call(this);
clearTimeout(BCNewsMarquee.rollOverTimer);
if (this.data.highlightItems.length > 0) {
BCNewsMarquee.rollOverTimer = setTimeout(BCNewsMarquee.doAutoNext, BCNewsMarquee.Time);
}
};
BCNewsMarquee.prototype.onHide = function() {
clearTimeout(BCNewsMarquee.rollOverTimer);
KPanel.prototype.onHide.call(this);
};
BCNewsMarquee.doAutoNext = function() {
clearTimeout(BCNewsMarquee.rollOverTimer);
if(BCNewsMarquee.instance.l1 == BCNewsMarquee.instance.l2) {
BCNewsMarquee.instance.l1 = 0;
BCNewsMarquee.instance.l2 = BCNewsMarquee.instance.div1.offsetWidth;
} else {
BCNewsMarquee.instance.l1 -= 2;
if(BCNewsMarquee.instance.l1 < BCNewsMarquee.instance.div1.offsetWidth * -1) {
BCNewsMarquee.instance.l1 = BCNewsMarquee.instance.div2.offsetWidth;
}
BCNewsMarquee.instance.l2 -= 2;
if(BCNewsMarquee.instance.l2 < BCNewsMarquee.instance.div2.offsetWidth * -1) {
BCNewsMarquee.instance.l2 = BCNewsMarquee.instance.div1.offsetWidth;
}
}
BCNewsMarquee.instance.div1.style.left = BCNewsMarquee.instance.l1 + 'px';
BCNewsMarquee.instance.div2.style.left = BCNewsMarquee.instance.l2 + 'px';
if (BCNewsMarquee.instance.data.highlightItems.length > 0)
BCNewsMarquee.rollOverTimer = setTimeout(BCNewsMarquee.doAutoNext, BCNewsMarquee.Time);
};
BCPressList.prototype = new BCWebsiteKList();
BCPressList.prototype.constructor = BCPressList;
function BCPressList(parent) {
if (parent != null) {
BCWebsiteKList.call(this, parent);
this.hash = '/item-list';
}
}
BCPressList.prototype.onLoad = function(data) {
if (this.data == null) {
this.data = {};
}
KSystem.merge(this.data, data);
this.draw();
}
BCPressList.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
this.totalCount = this.data.pageCount * this.perPage;
if (this.data.pageCount <= 1) {
this.setStyle({
display: 'none'
}, KWidget.PAGINATION_DIV);
}
if (this.data.galleryItems.length > 0) {
this.setTotalPages(this.data.pageCount, true);
for ( var index in this.data.galleryItems) {
var itemInfo = this.data.galleryItems[index];
var itemPanel = new KPanel(this);
itemPanel.addCSSClass('ItemPanel');
{
var itemText = new KText(itemPanel);
itemText.hash = '/item-text';
itemText.addCSSClass('ItemText');
itemText.setTitle(itemInfo.fileTitle);
itemText.setText(itemInfo.fileDescription);
itemPanel.appendChild(itemText);
itemPanel.clearBoth();
var downloadBt = new BCWebsiteKButton(itemPanel, this.translations.download, 'more', null);
downloadBt.file = itemInfo.fileInternalPath;
downloadBt.addEventListener('click', function(e){
var widget = KSystem.getEventWidget(e);
window.open(widget.file);
});
downloadBt.addCSSClass('DownloadBt');
itemPanel.appendChild(downloadBt);
}
this.appendChild(itemPanel);
var bottomBorder = window.document.createElement('div');
bottomBorder.className = 'BottomBorder';
itemPanel.childDiv(KWidget.CONTAINER_DIV).appendChild(bottomBorder);
}
} else {
var noContent = new KText(this);
noContent.addCSSClass('NoContent');
noContent.setText(this.translations.noContent);
this.appendChild(noContent);
}
BCWebsiteKList.prototype.draw.call(this);
}
BCProductHighlight.prototype = new KPanel();
BCProductHighlight.prototype.constructor = BCProductHighlight;
function BCProductHighlight(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
this.addLocationListener(BCProductHighlight.toggleHighlights, [BCMicroSite.productPageHash + '/*']);
this.loadTranslations();
this.highlightsPageHashLast = null;
this.highlightsPageHash = null;
this.setStyle( {
display : 'none'
});
}
}
BCProductHighlight.prototype.load = function() {
if (this.highlightsPageHash){
var params = {
contentView : 'TemplateBlock(templateHandler)',
contentID : 'Highlight:highlight.list.block.php',
args : {
'urlHash' : this.highlightsPageHash,
'categoryID' : 326
}
};
this.kinky.get(this, 'php:Frontend:GetBlock', params);
}
}
BCProductHighlight.prototype.onLoad = function(data) {
if (!this.data) {
this.data = {};
}
this.data.highlights = data.highlightItems;
this.draw();
}
BCProductHighlight.prototype.draw = function() {
if (this.data.highlights.length > 0){
this.setTitle(this.translations.title);
for(var index in this.data.highlights){
var highlight = new KLink(this, 'javascript:void(0);', this.data.highlights[index].image);
highlight.url = this.data.highlights[index].url;
highlight.addEventListener('click', function(e) {
var wid = KSystem.getEventWidget(e);
var url = wid.url;
if (url.indexOf('http://') == 0) {
window.open(url, '_blank');
} else {
KBreadcrumb.dispatchURL({
url : url
});
}
});
this.appendChild(highlight, this.highlightsPageHash);
}
this.hideContext();
this.changeContext(this.highlightsPageHash);
this.showContext();
} else {
this.hideContext();
this.setStyle( {
display : 'none'
});
}
KPanel.prototype.draw.call(this);
}
BCProductHighlight.toggleHighlights = function(widget, hash){
if(!Kinky.site.childWidget(hash) instanceof KPageDialog) {
var reg_exp = new RegExp(BCMicroSite.productPageHash);
if (reg_exp.test(hash)) {
widget.highlightsPageHash = Kinky.site.childWidget('/' + hash.split('/')[1] + '/' + hash.split('/')[2]).data.contentID;
if(widget.highlightsPageHash != widget.highlightsPageHashLast) {
widget.highlightsPageHashLast = widget.highlightsPageHash;
if(widget.childWidgets(widget.highlightsPageHash) != null) {
widget.hideContext();
widget.changeContext(widget.highlightsPageHash);
widget.showContext();
} else {
widget.load();
}
}
widget.setStyle( {
display : 'block'
});
} else {
widget.setStyle( {
display : 'none'
});
}
}
}
BCRichtext.prototype = new KText();
BCRichtext.prototype.constructor = BCRichtext;
function BCRichtext(parent) {
if (parent != null) {
KText.call(this, parent);
this.hash = '/richtext';
}
}
BCRichtext.prototype.draw = function() {
if (Kinky.site.colors && Kinky.site.colors.textColor) {
this.setStyle({
color: Kinky.site.colors.textColor
});
}
if (this.data.config && this.data.config.html){
this.setText(this.data.config.html);
}
KText.prototype.draw.call(this);
};
BCTooltip.prototype = new KTooltip();
BCTooltip.prototype.constructor = BCTooltip;
function BCTooltip(parent, params) {
if (parent != null) {
this.simpleWidget = false;
KTooltip.call(this, parent, params);
this.addCSSClass('BCDivBackground', KWidget.BACKGROUND_DIV);
this.addCSSClass('BCTooltipContent', KWidget.CONTENT_DIV);
this.leftDiv = window.document.createElement('div');
this.leftDiv.className = 'BCTooltipLeft BCBackgroundLeft';
this.middleDiv = window.document.createElement('div');
this.middleDiv.className = 'BCTooltipMiddle BCBackgroundMiddle';
this.rightDiv = window.document.createElement('div');
this.rightDiv.className = 'BCTooltipRight BCBackgroundRight';
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.leftDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.middleDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.rightDiv);
}
}
BCTooltip.prototype.draw = function() {
if (this.data.text) {
if (this.data.isHTML) {
this.textContent.innerHTML = this.data.text;
}
else {
this.textContent.appendChild(window.document.createTextNode(this.data.text));
}
KSystem.addEventListener(this.target, 'mouseout', KTooltip.hide);
KSystem.addEventListener(this.target, 'mousemove', BCTooltip.move);
this.panel.style.position = 'absolute';
this.panel.style.display = 'none';
this.panel.className = this.data.cssClass || this.panel.className;
window.document.body.appendChild(this.panel);
this.activate();
}
};
BCTooltip.move = function(event) {
var widget = KSystem.getEventWidget(event);
var mouseEvent = KSystem.getEvent(event);
widget.tooltip.panel.style.display = 'block';
var align = widget.tooltip.data.align || 'original';
if(align == 'top') {
widget.tooltip.panel.style.left = (KSystem.mouseX(mouseEvent) - (widget.tooltip.panel.offsetWidth / 2) + widget.tooltip.data.offsetX) + 'px';
widget.tooltip.panel.style.top = (KSystem.mouseY(mouseEvent) - widget.tooltip.panel.offsetHeight - widget.tooltip.data.offsetY) + 'px';
} else if(align == 'bottom') {
widget.tooltip.panel.style.left = (KSystem.mouseX(mouseEvent) - (widget.tooltip.panel.offsetWidth / 2) + widget.tooltip.data.offsetX) + 'px';
widget.tooltip.panel.style.top = (KSystem.mouseY(mouseEvent) + widget.tooltip.data.offsetY) + 'px';
} else if(align == 'left') {
widget.tooltip.panel.style.top = (KSystem.mouseY(mouseEvent) - (widget.tooltip.panel.offsetHeight / 2) + widget.tooltip.data.offsetY) + 'px';
widget.tooltip.panel.style.left = (KSystem.mouseX(mouseEvent) - widget.tooltip.panel.offsetWidth - widget.tooltip.data.offsetX) + 'px';
} else if(align == 'right') {
widget.tooltip.panel.style.top = (KSystem.mouseY(mouseEvent) - (widget.tooltip.panel.offsetHeight / 2) + widget.tooltip.data.offsetY) + 'px';
widget.tooltip.panel.style.left = (KSystem.mouseX(mouseEvent) + widget.tooltip.data.offsetX) + 'px';
} else if(align == 'original') {
KTooltip.move(event);
}
};
BCTooltip.showTooltip = function(parent, params, event) {
if (parent instanceof KWidget) {
parent = parent.content;
}
if (event) {
var mouseEvent = KSystem.getEvent(event);
params.left = KSystem.mouseX(mouseEvent);
params.top = KSystem.mouseY(mouseEvent);
}
var tooltip = new BCTooltip(parent, params);
tooltip.go();
};
BCWebsiteAccordionList.prototype = new KLayeredPanel();
BCWebsiteAccordionList.prototype.constructor = BCWebsiteAccordionList;
function BCWebsiteAccordionList(parent) {
if (parent) {
KLayeredPanel.call(this, parent, 'BCWebsiteAccordionList');
this.hash = '/accordion-list';
/*
this.tabEffects = {
enter : {
f : KEffects.easeOutExpo,
type : 'resize',
duration : 200,
go : {
height : 50
},
lock : {
width : true
},
onStart : function(widget, tween) {
tween.go.height = widget.getHeight();
}
},
exit : {
f : KEffects.easeOutExpo,
type : 'resize',
duration : 200,
go : {
height : 50
},
lock : {
width : true
}
}
};
*/
}
}
BCWebsiteAccordionList.prototype.draw = function() {
var translations = this.getParent('KPage').getTranslation(this.className);
if (this.data.itemList.length > 0) {
{
var titlePanel = new KPanel(this);
titlePanel.addCSSClass('TitlePanel');
var titleText = new KText(titlePanel);
titleText.addCSSClass('TitleText');
titleText.setText(translations.opportunityList);
titlePanel.appendChild(titleText);
var applyButton = new BCWebsiteKButton(titlePanel, translations.applyHere, 'applyJob', function(){
scrollTo(0,600);
});
applyButton.addCSSClass('ApplyButton');
titlePanel.appendChild(applyButton);
this.appendChild(titlePanel);
this.clearBoth();
}
for ( var index in this.data.itemList) {
var itemInfo = this.data.itemList[index];
var newItem = new KPanel(this);
newItem.addCSSClass('Item');
newItem.hash = '/opportunity/' + (parseInt(index) + 1);
var itemContent = new KText(newItem);
itemContent.setText(itemInfo.text);
newItem.appendChild(itemContent);
var itemButton = new BCWebsiteKButton(newItem, translations.applyOpportunity, 'applyOpportunity', function(e){
var widget = KSystem.getEventWidget(e);
widget.getParent('BCWebsiteAccordionList').parent.childWidget('/job-form').setOpportunity(widget.itemInfo);
});
itemButton.itemInfo = itemInfo;
itemButton.addCSSClass('ApplyOpportunity');
newItem.appendChild(itemButton);
this.addPanel(newItem, '
' + itemInfo.date + '
- ' + itemInfo.title + '
');
}
}
KLayeredPanel.prototype.draw.call(this);
}
BCWebsiteExportMap.prototype = new KPanel();
BCWebsiteExportMap.prototype.constructor = BCWebsiteExportMap;
function BCWebsiteExportMap(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.translations = null;
this.addQueryListener(BCWebsiteExportMap.changeRegion, [ '/region/*' ]);
this.actualContinent = null;
}
}
BCWebsiteExportMap.prototype.draw = function() {
var parentPage = this.getParent('KPage');
this.translations = parentPage.getTranslation(this.className);
if (parentPage.data.graphicStyle.images[0] && parentPage.data.graphicStyle.images[0].fileInternalPath){
var worldMap = new KImage(this, parentPage.data.graphicStyle.images[0].fileInternalPath, null);
this.appendChild(worldMap);
this.setStyle({
height : 'auto'
});
}else{
this.continentes = this.data.items;
this.worldMap = new KImage(this, '/images/site/mapa/mundo.png', null);
this.worldMap.addCSSClass('WorldMap Absolute');
this.appendChild(this.worldMap);
this.continentContainer = new KPanel(this);
this.continentContainer.addCSSClass('ContinentContainer');
this.overMapContainer = new KPanel(this);
this.overMapContainer.addCSSClass('OverContainer');
var map = new Array();
for ( var index in this.continentes) {
var continent = new BCContinent(this, this.continentes[index].closeUp);
continent.hash = '/continent/' + this.continentes[index].id;
if (this.continentes[index].points.length > 0) {
var pointContainer = window.document.createElement('div');
pointContainer.id = 'pointContainer_' + this.continentes[index].id;
pointContainer.className = 'PointContainer';
pointContainer.style.display = 'none';
for ( var idxPoints in this.continentes[index].points) {
var point = window.document.createElement('img');
point.src = '/images/site/map_pointer.png';
point.title = this.continentes[index].points[idxPoints].title;
point.alt = this.continentes[index].points[idxPoints].text;
point.style.left = ((this.continentes[index].points[idxPoints].x) * 100) + '%';
point.style.top = (this.continentes[index].points[idxPoints].y * 100) + '%';
pointContainer.appendChild(point);
KSystem.addEventListener(point, 'mouseover', function(event) {
var mouseEvent = KSystem.getEvent(event);
var target = KSystem.getEventTarget(event);
BCTooltip.showTooltip(target, {
text : "
" + target.title + "
" + target.alt,
isHTML : true,
offsetX : 0,
offsetY : 15,
align : 'top',
left : KSystem.mouseX(mouseEvent) + 15,
top : (KSystem.mouseY(mouseEvent) + 15),
cssClass : 'BCWebsiteExportMapPoint'
});
});
}
continent.content.appendChild(pointContainer);
}
this.continentContainer.appendChild(continent);
var overPlace = window.document.createElement('img');
overPlace.id = this.continentes[index].id;
overPlace.src = this.continentes[index].over;
this.overMapContainer.content.appendChild(overPlace);
if (this.continentes[index].map != null) {
map.push({
coords : this.continentes[index].map,
shape : 'poly',
onOver : BCWebsiteExportMap.showRegion,
onOut : BCWebsiteExportMap.hideRegion,
url : this.getLink({
query : '/region/' + this.continentes[index].id
})
});
}
}
this.appendChild(this.continentContainer);
this.appendChild(this.overMapContainer);
this.frame = new KImage(this, '/images/site/mapa/frame.png', null);
this.frame.addCSSClass('Absolute');
this.appendChild(this.frame);
this.frame.addMap({
map : map
});
this.backBt = new KLink(this, 'javascript:void(0);', '/images/site/mapa/back.png');
this.backBt.isImageLink = true;
this.appendChild(this.backBt);
this.backBt.addEventListener('click', function(e){
var parentWidget = KSystem.getEventWidget(e, 'BCWebsiteExportMap');
parentWidget.backToWorldMap();
});
}
KPanel.prototype.draw.call(this);
if (!(parentPage.data.graphicStyle.images[0] && parentPage.data.graphicStyle.images[0].fileInternalPath)){
var continentContainerChilds = this.continentContainer.childWidgets();
for ( var contIndex in continentContainerChilds) {
continentContainerChilds[contIndex].setStyle({
display : 'none'
});
}
this.backBt.setStyle({
display : 'none'
});
}
};
BCWebsiteExportMap.changeRegion = function(widget, query) {
if (widget.activated()) {
var continent = query.split('/')[2];
widget.backBt.setStyle({
display : 'block'
});
widget.overMapContainer.setStyle({
display : 'none'
});
widget.frame.setStyle({
display : 'none'
});
var pointContainer = window.document.getElementById('pointContainer_' + continent);
pointContainer.style.opacity = '0';
pointContainer.style.display = 'block';
widget.actualContinent = widget.continentContainer.childWidget('/continent/' + continent);
// fx
widget.actualContinent.setStyle({
opacity : '0',
width : '855px',
height : '316px'
}, widget.actualContinent.image);
widget.actualContinent.setStyle({
display : 'block'
});
KEffects.addEffect(widget.actualContinent.image, [ {
f : KEffects.easeOutExpo,
type : 'resize',
unit : 'px',
duration : 1000,
go : {
width : 633,
height : 234
}
}, {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : 1000,
go : {
alpha : 1
},
from : {
alpha : 0
},
onComplete : function(widget, tween) {
if (pointContainer) {
pointContainer.style.opacity = '0';
pointContainer.style.display = 'block';
pointContainer.style.left = '18px';
pointContainer.style.top = '-25px';
KEffects.addEffect(pointContainer, [ {
f : KEffects.easeOutExpo,
type : 'fade',
realAlpha : true,
duration : 1500,
go : {
alpha : 1
},
from : {
alpha : 0
}
}, {
f : KEffects.easeOutExpo,
type : 'move',
duration : 1500,
go : {
x : 0,
y : 0
},
from : {
x : 18,
y : -25
}
} ]);
}
}
} ]);
}
};
BCWebsiteExportMap.prototype.backToWorldMap = function(){
KBreadcrumb.dispatchURL({
query : ''
});
this.overMapContainer.setStyle({
display : 'block'
});
this.frame.setStyle({
display : 'block'
});
this.actualContinent.setStyle({
display : 'none'
});
this.backBt.setStyle({
display : 'none'
});
}
BCWebsiteExportMap.showRegion = function(event) {
var mouseEvent = KSystem.getEvent(event);
var target = KSystem.getEventTarget(event);
var href = target.href.split('/');
var region = href[href.length - 1];
var parentTarget = KSystem.getEventWidget(event, 'BCWebsiteExportMap');
BCTooltip.showTooltip(target, {
text : parentTarget.translations[region],
isHTML : true,
offsetX : 15,
offsetY : 0,
align : 'right',
left : KSystem.mouseX(mouseEvent) + 15,
top : (KSystem.mouseY(mouseEvent) + 15),
cssClass : 'BCWebsiteExportMapContinent'
});
document.getElementById(region).style.display = 'block';
};
BCWebsiteExportMap.hideRegion = function(event) {
var mouseEvent = KSystem.getEvent(event);
var target = KSystem.getEventTarget(event);
var href = target.href.split('/');
var region = href[href.length - 1];
document.getElementById(region).style.display = 'none';
};
BCWebsiteFooterMenu.prototype = new KIndex();
BCWebsiteFooterMenu.prototype.constructor = BCWebsiteFooterMenu;
function BCWebsiteFooterMenu(parent, id, data) {
if (parent) {
KIndex.call(this, parent, id, data);
BCWebsiteFooterMenu.activeTool = null;
this.widget_translations = {};
this.loadTranslations();
BCWebsiteFooterMenu.translations = this.getTranslation('BCWebsiteFooterMenu');
}
}
BCWebsiteFooterMenu.prototype.loadTranslations = function() {
};
BCWebsiteFooterMenu.prototype.getTranslation = function(widgetClass) {
if (this.widget_translations[widgetClass]) {
return this.widget_translations[widgetClass];
}
};
BCWebsiteFooterMenu.prototype.draw = function() {
var rightsText = new KText(this);
rightsText.setText(BCWebsiteFooterMenu.translations.rightsText);
this.appendChild(rightsText);
this.loadIndex(this.data);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.activate();
this.markIndex(this.getHash());
}
BCWebsiteFooterMenu.shareMe = function(event) {
var widget = KSystem.getEventWidget(event);
window.open('http://www.facebook.com/sharer.php?u=http://' + encodeURIComponent(window.location.host));
}
BCWebsiteFooterMenu.shareMeTwitter = function(event) {
var widget = KSystem.getEventWidget(event);
window.open('http://twitter.com/home?status=' + encodeURIComponent('Nelson'));
}
BCWebsiteFooterMenu.prototype.loadIndex = function(page, level, topUL, parent, pageIndex) {
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page, pageIndex++);
}
} else {
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
}
else {
if (page.graphicStyle && page.graphicStyle.images[0] && page.graphicStyle.images[0].fileInternalPath && page.graphicStyle.images[0].stateCode == 'destaque submenu'){
var exportLink = new KLink(this, this.getLink({
hash : page.redirectUrlHashText
}), page.graphicStyle.images[0].fileInternalPath);
exportLink.addCSSClass('BCFooterHighlightPage');
this.appendChild(exportLink);
}else{
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
}
catch (e) {
dump(parent, false, true);
}
var a = window.document.createElement('a');
if (page.graphicStyle.images.length > 0){
for (var image in page.graphicStyle.images){
if (page.graphicStyle.images[image].presentationGalleryFile == 1){
li.style.background = 'url(' + page.graphicStyle.images[image].fileInternalPath + ') no-repeat';
KCSS.addCSSClass('Special', li);
}
}
}
a.appendChild(window.document.createTextNode(page.menuText));
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
this.subIndex[page.urlHashText] = li;
li.appendChild(a);
ul = window.document.createElement('ul');
ul.className = 'KIndexLevel' + (level + 1);
li.appendChild(ul);
topUL.appendChild(li);
}
}
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page);
}
}
}
BCWebsiteFormContact.prototype = new KForm();
BCWebsiteFormContact.prototype.constructor = BCWebsiteFormContact;
function BCWebsiteFormContact(parent) {
if (parent != null) {
KForm.call(this, parent);
this.staticForm = true;
this.action = 'php:Contact:Submit';
this.translations = null;
this.hash = '/BCWebsiteFormContact';
}
}
BCWebsiteFormContact.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
var firstName = new KInput(this, 'text', this.translations.firstName, 'firstName', true);
firstName.addCSSClass('NameInput');
firstName.addValidator(/.+/, this.translations.firstNameError);
this.addInput(firstName);
var lastName = new KInput(this, 'text', this.translations.lastName, 'lastName', true);
lastName.addCSSClass('NameInput');
lastName.addValidator(/.+/, this.translations.lastNameError);
this.addInput(lastName);
this.clearBoth();
var contactEmail = new KInput(this, 'text', this.translations.email, 'contactEmail', true);
contactEmail.addCSSClass('NameInput');
contactEmail.addValidator(/(\w+@[a-zA-Z_-]+?\.[a-zA-Z]{2,6})/, this.translations.emailError);
this.addInput(contactEmail);
var contactPhone = new KInput(this, 'text', this.translations.phone, 'contactPhone', true);
contactPhone.addCSSClass('NameInput');
contactPhone.addValidator(/[0-9]{9,9}/, this.translations.phoneError);
this.addInput(contactPhone);
this.clearBoth();
var contactMessage = new KInput(this, 'textarea', this.translations.message, 'contactMessage', true);
contactMessage.addCSSClass('MessageInput');
contactMessage.addValidator(/.+/, this.translations.messageError);
this.addInput(contactMessage);
var mandatoryText = new KText(this);
mandatoryText.addCSSClass('MandatoryText');
mandatoryText.setText(this.translations.mandatoryFields);
this.appendChild(mandatoryText);
this.clearBoth();
this.errorPanel = new KText(this);
this.errorPanel.addCSSClass('ErrorPanel');
this.appendChild(this.errorPanel);
var submitButton = new BCWebsiteKInput(this, this.translations.submit, 'submit');
this.addInput(submitButton);
KForm.prototype.draw.call(this);
this.errorPanel.setStyle({
display : 'none'
});
}
BCWebsiteFormContact.prototype.onValidate = function(text, params, status) {
if (status) {
params.contactName = params.firstName + ' ' + params.lastName;
params.categoryID = this.data.config.contentID;
this.disable();
return params;
}
else {
var first = true;
for ( var element in params) {
var input = params[element].getInput();
if (first) {
first = false;
input.focus();
}
input.style.color = 'red';
this.errorPanel.setStyle({
color : '#b11f7d'
});
this.errorPanel.setTitle('

', true);
this.errorPanel.setText(params[element].getErrorMessage(params[element].validationIndex));
this.errorPanel.setStyle({
display : 'block'
});
break;
}
return false;
}
}
BCWebsiteFormContact.prototype.onSuccess = function(data) {
this.enable();
this.reset();
this.errorPanel.setStyle({
color : '#519719'
});
// this.errorPanel.setTitle('

', true);
this.errorPanel.setText(this.translations.successText);
this.errorPanel.setStyle({
display : 'block'
});
}
BCWebsiteFormContact.prototype.onError = function(data) {
this.enable();
this.errorPanel.setStyle({
color : '#b11f7d'
});
this.errorPanel.setTitle('

', true);
this.errorPanel.setText(this.translations.errorText);
this.errorPanel.setStyle({
display : 'block'
});
}
BCWebsiteHighlightsWidget.prototype = new KPanel();
BCWebsiteHighlightsWidget.prototype.constructor = BCWebsiteHighlightsWidget;
function BCWebsiteHighlightsWidget(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
this.addLocationListener(BCWebsiteHighlightsWidget.toggleHighlights);
// this.loadTranslations();
this.highlightsPageHashLast = null;
this.highlightsPageHash = null;
this.setStyle( {
display : 'none'
});
}
}
BCWebsiteHighlightsWidget.prototype.load = function() {
if (this.highlightsPageHash){
var params = {
contentView : 'TemplateBlock(templateHandler)',
contentID : 'Highlight:highlight.list.block.php',
args : {
'urlHash' : this.highlightsPageHash
}
};
this.kinky.get(this, 'php:Frontend:GetBlock', params);
}
}
BCWebsiteHighlightsWidget.prototype.onLoad = function(data) {
if (!this.data) {
this.data = {};
}
this.data.highlights = data.highlightItems;
this.draw();
}
BCWebsiteHighlightsWidget.prototype.draw = function() {
if (this.data.highlights.length > 0){
for(var index in this.data.highlights){
var highlight = new KLink(this, 'javascript:void(0);', this.data.highlights[index].image);
highlight.url = this.data.highlights[index].url;
highlight.addEventListener('click', function(e) {
var wid = KSystem.getEventWidget(e);
var url = wid.url;
if (url.indexOf('http://') == 0) {
window.open(url, '_blank');
} else {
KBreadcrumb.dispatchURL({
url : url
});
}
});
this.appendChild(highlight, this.highlightsPageHash);
}
this.hideContext();
this.changeContext(this.highlightsPageHash);
this.showContext();
} else {
this.hideContext();
this.setStyle( {
display : 'none'
});
}
KPanel.prototype.draw.call(this);
}
BCWebsiteHighlightsWidget.toggleHighlights = function(widget, hash){
if(!(Kinky.site.childWidget(hash) instanceof KPageDialog)) {
if(Kinky.site.childWidget(hash) instanceof BCWebsiteTwoColumnNoHighlight){
widget.highlightsPageHash = Kinky.site.childWidget('/' + hash.split('/')[1]).data.contentID;
}else{
widget.setStyle( {
display : 'none'
});
return;
}
if (widget.highlightsPageHash){
if(widget.highlightsPageHash != widget.highlightsPageHashLast) {
widget.highlightsPageHashLast = widget.highlightsPageHash;
if(widget.childWidgets(widget.highlightsPageHash) != null) {
widget.hideContext();
widget.changeContext(widget.highlightsPageHash);
widget.showContext();
} else {
widget.load();
}
}
widget.setStyle( {
display : 'block'
});
}
}
}
BCWebsiteJobForm.prototype = new KForm();
BCWebsiteJobForm.prototype.constructor = BCWebsiteJobForm;
function BCWebsiteJobForm(parent) {
if (parent != null) {
KForm.call(this, parent);
this.staticForm = true;
this.action = 'php:JobOpportunity:SubmitAnswer';
this.hash = '/job-form';
this.translations = null;
}
}
BCWebsiteJobForm.prototype.setOpportunity = function(data) {
if (data == null) {
this.opportunityHidden.setValue(0);
this.setTitle(this.translations.formTitle);
}
else {
this.opportunityHidden.setValue(data.id);
this.setTitle(data.title);
}
}
BCWebsiteJobForm.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
this.setTitle(this.translations.formTitle);
var topBt = new BCWebsiteKButton(this, this.translations.backToTop, 'topBt', function() {
scrollTo(0, 0);
});
topBt.addCSSClass('BackToTopButton');
this.appendTitleChild(topBt);
var contactName = new KInput(this, 'text', this.translations.name, 'name', true);
contactName.addCSSClass('NameInput');
contactName.addValidator(/.+/, this.translations.nameError);
this.addInput(contactName);
var contactEmail = new KInput(this, 'text', this.translations.email, 'email', true);
contactEmail.addCSSClass('NameInput');
contactEmail.addValidator(/(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/, this.translations.emailError);
this.addInput(contactEmail);
this.clearBoth();
var contactPhone = new KInput(this, 'text', this.translations.phone, 'phone', true);
contactPhone.addCSSClass('NameInput');
contactPhone.addValidator(/[0-9]{9,9}/, this.translations.phoneError);
this.addInput(contactPhone);
var contactMessage = new KInput(this, 'textarea', this.translations.message, 'apresentation', true);
contactMessage.addCSSClass('MessageInput');
contactMessage.addValidator(/.+/, this.translations.messageError);
this.addInput(contactMessage);
this.clearBoth();
var contactCV = new KFile(this, 'Upload', 'curriculumFile');
contactCV.addValidator(/.+/, this.translations.cvError);
contactCV.addCSSClass('UploadedCV');
contactCV.maxFile = 1;
contactCV.setLabel(this.translations.cv);
contactCV.noPrompt = true;
contactCV.setButtonSize(72, 37);
this.addInput(contactCV);
var mandatoryText = new KText(this);
mandatoryText.addCSSClass('MandatoryText');
mandatoryText.setText(this.translations.mandatoryFields);
this.appendChild(mandatoryText);
this.clearBoth();
this.errorPanel = new KText(this);
this.errorPanel.addCSSClass('ErrorPanel');
this.appendChild(this.errorPanel);
var submitButton = new BCWebsiteKInput(this, this.translations.submit, 'submit');
this.addInput(submitButton);
this.opportunityHidden = new KInput(this, 'hidden', '', 'opportunityID');
this.opportunityHidden.setValue(this.data.config.contentID);
this.addInput(this.opportunityHidden);
KForm.prototype.draw.call(this);
this.errorPanel.setStyle({
display : 'none'
});
};
BCWebsiteJobForm.prototype.onValidate = function(text, params, status) {
if (status) {
this.disable();
return params;
}
else {
var first = true;
for ( var element in params) {
var input = params[element].getInput();
if (first) {
first = false;
if (input) {
input.focus();
}
}
if (input) {
input.style.color = 'red';
}
this.errorPanel.setStyle({
color : '#b11f7d'
});
this.errorPanel.setTitle('

', true);
this.errorPanel.setText(params[element].getErrorMessage(params[element].validationIndex));
this.errorPanel.setStyle({
display : 'block'
});
break;
}
return false;
}
}
BCWebsiteJobForm.prototype.onSuccess = function(data) {
this.enable();
this.reset();
this.errorPanel.setStyle({
color : '#519719'
});
// this.errorPanel.setTitle('

', true);
this.errorPanel.setText(this.translations.successText);
this.errorPanel.setStyle({
display : 'block'
});
}
BCWebsiteJobForm.prototype.onError = function(data) {
this.enable();
this.errorPanel.setStyle({
color : '#b11f7d'
});
this.errorPanel.setTitle('

', true);
this.errorPanel.setText(this.translations.errorText);
this.errorPanel.setStyle({
display : 'block'
});
}
BCWebsiteKButton.prototype = new KButton();
BCWebsiteKButton.prototype.constructor = BCWebsiteKButton;
function BCWebsiteKButton(parent, label, id, callback) {
if (parent != null) {
this.simpleWidget = false;
KButton.call(this, parent, label, id, callback);
this.leftDiv = window.document.createElement('div');
this.leftDiv.className = 'BCWebsiteKButtonLeft';
this.middleDiv = window.document.createElement('div');
this.middleDiv.className = 'BCWebsiteKButtonMiddle';
this.rightDiv = window.document.createElement('div');
this.rightDiv.className = 'BCWebsiteKButtonRight';
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.leftDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.middleDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.rightDiv);
}
}
BCWebsiteKButton.prototype.draw = function() {
KButton.prototype.draw.call(this);
//this.middleDiv.appendChild(this.inputContainer);
}
BCWebsiteKInput.prototype = new KInput();
BCWebsiteKInput.prototype.constructor = BCWebsiteKInput;
function BCWebsiteKInput(parent, label, id) {
if (parent != null) {
this.simpleWidget = false;
KInput.call(this, parent, 'submit', label, id, false);
this.leftDiv = window.document.createElement('div');
this.leftDiv.className = 'BCWebsiteKInputLeft';
this.middleDiv = window.document.createElement('div');
this.middleDiv.className = 'BCWebsiteKInputMiddle';
this.rightDiv = window.document.createElement('div');
this.rightDiv.className = 'BCWebsiteKInputRight';
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.leftDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.middleDiv);
this.childDiv(KWidget.BACKGROUND_DIV).appendChild(this.rightDiv);
}
}
BCWebsiteKInput.prototype.draw = function() {
KInput.prototype.draw.call(this);
//this.middleDiv.appendChild(this.inputContainer);
}
BCWebsiteLangPanel.prototype = new KPanel();
BCWebsiteLangPanel.prototype.constructor = BCWebsiteLangPanel;
function BCWebsiteLangPanel(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
}
}
BCWebsiteLangPanel.prototype.load = function() {
if (!this.data)
this.data = {};
this.data.contentView = 'TemplateBlock(templateHandler)';
this.data.contentID = 'Page:language.list.block.php';
this.data.feService = 'php:Frontend:GetBlock';
this.data.feServiceArgs = {
args : {
versionCode : Kinky.BASE_VERSION
}
};
KPanel.prototype.load.call(this);
}
BCWebsiteLangPanel.prototype.onLoad = function(data) {
KSystem.merge(this.data, data);
this.draw();
}
BCWebsiteLangPanel.prototype.draw = function() {
var currentLanguage = Kinky.getCurrentLanguage();
if (this.data.languageList && this.data.languageList.length > 0) {
for ( var index in this.data.languageList) {
var lang = new KLink(this, 'javascript:void(0);');
if (this.data.languageList[index] == currentLanguage){
lang.addCSSClass('Selected');
}
lang.langID = this.data.languageList[index];
lang.setLinkText(this.data.languageList[index].toUpperCase());
lang.addEventListener('click', function(e) {
var element = KSystem.getEventWidget(e);
window.location = Kinky.SITE_URL + element.langID + '/';
});
this.appendChild(lang);
break;
}
}
var rightBorder = window.document.createElement('div');
rightBorder.className = 'RightBorder';
this.childDiv(KWidget.CONTAINER_DIV).appendChild(rightBorder);
KPanel.prototype.draw.call(this);
};
BCWebsiteList.prototype = new BCWebsiteKList();
BCWebsiteList.prototype.constructor = BCWebsiteList;
function BCWebsiteList(parent) {
if (parent != null) {
BCWebsiteKList.call(this, parent);
this.hash = '/item-list';
this.addActionListener(BCWebsiteList.toggleNewsByUrl, [ '/news/*' ]);
this.translation = null;
}
}
BCWebsiteList.prototype.onLoad = function(data) {
if (this.data == null) {
this.data = {};
}
KSystem.merge(this.data, data);
this.draw();
}
BCWebsiteList.prototype.draw = function() {
this.translation = this.getParent('KPage').getTranslation(this.className);
this.totalCount = this.data.pageCount * this.perPage;
if (this.data.pageCount <= 1) {
this.setStyle( {
display : 'none'
}, KWidget.PAGINATION_DIV);
}
if (this.data.itemList.length > 0) {
this.setTotalPages(this.data.pageCount, true);
for ( var index in this.data.itemList) {
var itemInfo = this.data.itemList[index];
var image = (itemInfo.image && itemInfo.image.length) > 0 && itemInfo.image.charAt(itemInfo.image.length - 1) != '/' ? itemInfo.image : null;
var itemPanel = new KPanel(this);
itemPanel.addCSSClass('ItemPanel');
itemPanel.hash = '/item-panel/' + itemInfo.id;
itemPanel.NewsToggled = false;
{
if (image) {
var itemImage = new KImage(itemPanel, image);
itemImage.addCSSClass('ItemImage');
itemPanel.appendChild(itemImage);
}
var itemText = new KText(itemPanel);
itemText.hash = '/item-text';
itemText.addCSSClass('ItemText');
itemText.setTitle(itemInfo.title);
itemText.data.desc = itemInfo.text;
itemText.data.shortDesc = itemInfo.introText;
if (this.showReadMore == true) {
// noticias - mostrar a breve descricao
itemText.setText(itemInfo.introText);
} else {
// dicas - mostrar ja a descricao completa
itemText.setText(itemInfo.text);
}
if (image) {
itemText.addCSSClass('ShortText');
}
itemPanel.appendChild(itemText);
if (this.showReadMore == true) {
var readMore = new BCWebsiteKButton(itemPanel, this.translation.readMore, 'more', null);
readMore.hash = '/button';
if (!image) {
readMore.setStyle( {
cssFloat : 'left'
});
}
readMore.addCSSClass('BtReadMore');
itemPanel.appendChild(readMore);
readMore.addEventListener('mouseover', function(event) {
var widget = KSystem.getEventWidget(event);
if (!widget.parent.NewsToggled) {
widget.addCSSClass('BtReadMoreOver');
}
});
readMore.addEventListener('mouseout', function(event) {
var widget = KSystem.getEventWidget(event);
widget.removeCSSClass('BtReadMoreOver');
});
readMore.addEventListener('click', function(event) {
var widget = KSystem.getEventWidget(event);
var parentWidget = widget.parent;
if (!parentWidget.NewsToggled){
KBreadcrumb.dispatchURL({
action : '/news/' + parentWidget.hash.split('/')[2]
});
}else{
parentWidget.parent.toggleNews(parentWidget);
KBreadcrumb.dispatchURL({
action : ''
});
}
});
}
}
this.appendChild(itemPanel);
var bottomBorder = window.document.createElement('div');
bottomBorder.className = 'BottomBorder';
itemPanel.childDiv(KWidget.CONTAINER_DIV).appendChild(bottomBorder);
}
} else {
var noContent = new KText(this);
noContent.addCSSClass('NoContent');
noContent.setText(this.translation.noContent);
this.appendChild(noContent);
}
BCWebsiteKList.prototype.draw.call(this);
}
BCWebsiteList.prototype.toggleNews = function(widget) {
var textWidget = widget.childWidget('/item-text');
var btWidget = widget.childWidget('/button');
if (!widget.NewsToggled) {
// vamos mostrar o detalhe e mudar o botao
textWidget.setText(textWidget.data.desc);
widget.NewsToggled = true;
btWidget.setText(this.translation.close);
btWidget.addCSSClass('BtReadMoreSelected');
btWidget.removeCSSClass('BtReadMoreOver');
} else {
textWidget.setText(textWidget.data.shortDesc);
widget.NewsToggled = false;
btWidget.setText(this.translation.readMore);
btWidget.removeCSSClass('BtReadMoreSelected');
}
}
BCWebsiteList.toggleNewsByUrl = function(widget, action) {
var newsID = action.split('/')[2];
var panel = widget.childWidget('/item-panel/' + newsID);
if (panel) {
widget.toggleNews(panel);
}
}
BCWebsiteMainMenu.prototype = new KIndex();
BCWebsiteMainMenu.prototype.constructor = BCWebsiteMainMenu;
function BCWebsiteMainMenu(parent, id, data) {
if (parent) {
KIndex.call(this, parent, id, data);
this.changeMenuIndex = 0;
this.lastSelected = null;
}
}
BCWebsiteMainMenu.prototype.setMarked = function(hash) {
this.markIndex(hash);
}
BCWebsiteMainMenu.prototype.draw = function() {
this.changeMenuIndex = Math.round(this.data.pages.length / 2);
this.loadIndex(this.data);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.activate();
this.markIndex(this.getHash());
}
BCWebsiteMainMenu.prototype.hide = function() {
if(this.lastSelected != null){
KCSS.removeCSSClass('KIndexLevel1ItemSelected', this.lastSelected);
KCSS.removeCSSClass('KIndexLevel1Over', this.lastSelected.parentNode);
this.lastSelected = null;
}
}
BCWebsiteMainMenu.prototype.loadIndex = function(page, level, topUL, parent, pageIndex) {
if (!pageIndex) {
pageIndex = 1;
}
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page, pageIndex++);
}
}
else {
if (level > 2) {
return;
}
if (level > 0) {
if (page.urlHashText == '/homepage') {
return;
}
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
}
catch (e) {
dump(parent, false, true);
}
if (level == 1) {
var leftDiv = window.document.createElement('div');
leftDiv.className = 'LeftBt';
var middleDiv = window.document.createElement('div');
middleDiv.className = 'MiddleBt';
var rightDiv = window.document.createElement('div');
rightDiv.className = 'RightBt';
}
var a = window.document.createElement('a');
if (page.graphicStyle && page.graphicStyle.textImages && page.graphicStyle.textImages.pageMenuTitle) {
a.appendChild(KCSS.img(page.graphicStyle.textImages.pageMenuTitle.base, page.menuText, page.titleText));
}
else {
a.appendChild(window.document.createTextNode(page.menuText));
}
this.subIndex[page.urlHashText] = li;
if (level == 1) {
a.style.opacity = 1;
KSystem.addEventListener(a, 'mouseover', function(e) {
KEffects.addEffect(a, {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : 800,
go : {
alpha : 0.4
},
from : {
alpha : 1
}
});
});
KSystem.addEventListener(a, 'mouseout', function(e) {
KEffects.addEffect(a, {
f : KEffects.easeInOutExpo,
type : 'fade',
realAlpha : true,
duration : 800,
go : {
alpha : 1
},
from : {
alpha : 0.4
}
});
});
KSystem.addEventListener(li, 'click', function(e) {
var target = KSystem.getEventTarget(e);
if(target.tagName.toLowerCase() == 'a'){
var mainWidget = KSystem.getEventWidget(e, 'BCWebsiteMainMenu');
if (mainWidget.lastSelected == li ) {
KCSS.removeCSSClass('KIndexLevel1ItemSelected', li);
mainWidget.lastSelected = null;
KCSS.removeCSSClass('KIndexLevel1Over', li.parentNode);
}
else {
if (mainWidget.lastSelected) {
KCSS.removeCSSClass('KIndexLevel1ItemSelected', mainWidget.lastSelected);
}
KCSS.addCSSClass('KIndexLevel1Over', li.parentNode);
KCSS.addCSSClass('KIndexLevel1ItemSelected', li);
mainWidget.lastSelected = li;
var liChilds = li.getElementsByTagName('LI');
var els = li.getElementsByTagName('*');
for ( var i = 0; i < els.length; i++) {
if (els[i].tagName == 'IMG') {
els[i].src = liChilds[0].image;
continue;
}
if (els[i].className == 'TextContainer') {
els[i].innerHTML = '
' + liChilds[0].pageTitle + '
' + liChilds[0].imageText + '
';
continue;
}
}
}
}
});
var secundaryMenu = window.document.createElement('div');
{
var title = window.document.createElement('h2');
title.innerHTML = page.description;
secundaryMenu.appendChild(title);
var leftContainer = window.document.createElement('div');
leftContainer.className = 'LeftContainer';
{
var imgContainer = window.document.createElement('div');
imgContainer.className = 'ImgContainer';
{
var image = window.document.createElement('img');
imgContainer.appendChild(image);
}
leftContainer.appendChild(imgContainer);
var textContainer = window.document.createElement('div');
textContainer.className = 'TextContainer';
leftContainer.appendChild(textContainer);
}
secundaryMenu.appendChild(leftContainer);
var secundaryUL = window.document.createElement('ul');
secundaryMenu.className = 'SecundaryMenu';
secundaryMenu.appendChild(secundaryUL);
}
li.appendChild(secundaryMenu);
middleDiv.appendChild(a);
li.appendChild(leftDiv);
li.appendChild(middleDiv);
li.appendChild(rightDiv);
}
else {
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
li.appendChild(a);
a.innerHTML = '• ' + a.innerHTML;
KSystem.addEventListener(li, 'mouseover', function(e) {
var element = KSystem.getEventTarget(e);
if (!(element.tagName == 'LI')) {
element = element.parentNode;
}
var secundaryMenuElement = element.parentNode.parentNode;
var leftContainerElement = secundaryMenuElement.getElementsByTagName('div')[0];
for ( var elements in leftContainerElement.childNodes) {
if (leftContainerElement.childNodes[elements].className == 'ImgContainer') {
leftContainerElement.childNodes[elements].childNodes[0].src = element.image;
}
else if (leftContainerElement.childNodes[elements].className == 'TextContainer') {
leftContainerElement.childNodes[elements].innerHTML = '
' + element.pageTitle + '
' + element.imageText + '
';
}
}
});
for ( var image in page.graphicStyle.images) {
if (page.graphicStyle.images[image].stateCode == 'destaque submenu') {
li.image = page.graphicStyle.images[image].fileInternalPath;
li.imageText = page.graphicStyle.images[image].fileDescription;
}
}
li.pageTitle = page.menuText;
}
topUL.appendChild(li);
}
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, secundaryUL, page);
}
}
}
BCWebsiteProductHighlights.prototype = new KPanel();
BCWebsiteProductHighlights.prototype.constructor = BCWebsiteProductHighlights;
function BCWebsiteProductHighlights(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.loadService = true;
this.addLocationListener(BCWebsiteProductHighlights.toggleHighlights);
// this.loadTranslations();
this.highlightsPageHashLast = null;
this.highlightsPageHash = null;
this.setStyle({
display : 'none'
});
}
}
BCWebsiteProductHighlights.prototype.load = function() {
if (this.highlightsPageHash) {
var params = {
contentView : 'TemplateBlock(templateHandler)',
contentID : 'Highlight:highlight.list.block.php',
args : {
'urlHash' : this.highlightsPageHash
}
};
this.kinky.get(this, 'php:Frontend:GetBlock', params);
}
}
BCWebsiteProductHighlights.prototype.onLoad = function(data) {
if (!this.data) {
this.data = {};
}
this.data.highlights = data.highlightItems;
this.draw();
}
BCWebsiteProductHighlights.prototype.draw = function() {
if (this.data.highlights.length > 0) {
var first = true;
for ( var index in this.data.highlights) {
var highlight = new KPanel(this);
{
var highlightItem = new KLink(highlight, 'javascript:void(0);', this.data.highlights[index].image);
highlightItem.setLinkText(this.data.highlights[index].name);
highlightItem.setStyle({
cursor : 'default'
}, KLink.LINK_ELEMENT);
highlight.appendChild(highlightItem);
var highlightBt = new BCWebsiteKButton(highlight, 'Saber mais', 'more', null);
highlightBt.url = this.data.highlights[index].url;
highlightBt.addEventListener('click', function(e) {
var wid = KSystem.getEventWidget(e);
var url = wid.url;
if (url.indexOf('http://') == 0) {
window.open(url, '_blank');
}
else {
KBreadcrumb.dispatchURL({
url : url
});
}
});
highlight.appendChild(highlightBt);
}
if (first) {
highlightBt.setStyle({
border : 'none'
});
}
this.appendChild(highlight, this.highlightsPageHash);
first = false;
}
this.hideContext();
this.changeContext(this.highlightsPageHash);
this.showContext();
}
else {
this.hideContext();
this.setStyle({
display : 'none'
});
}
KPanel.prototype.draw.call(this);
}
BCWebsiteProductHighlights.toggleHighlights = function(widget, hash) {
if (!(Kinky.site.childWidget(hash) instanceof KPageDialog)) {
if (Kinky.site.childWidget(hash) instanceof BCWebsiteThreeColumnHighlight) {
// produtos
widget.highlightsPageHash = Kinky.site.childWidget('/' + hash.split('/')[1] + '/' + hash.split('/')[2]).data.contentID;
}
else {
widget.setStyle({
display : 'none'
});
return;
}
if (widget.highlightsPageHash) {
if (widget.highlightsPageHash != widget.highlightsPageHashLast) {
widget.highlightsPageHashLast = widget.highlightsPageHash;
if (widget.childWidgets(widget.highlightsPageHash) != null) {
widget.hideContext();
widget.changeContext(widget.highlightsPageHash);
widget.showContext();
}
else {
widget.load();
}
}
widget.setStyle({
display : 'block'
});
}
}
}
BCWebsiteProductSubPagesLevel1.prototype = new KIndex();
BCWebsiteProductSubPagesLevel1.prototype.constructor = BCWebsiteProductSubPagesLevel1;
function BCWebsiteProductSubPagesLevel1(parent) {
if (parent != null) {
KIndex.call(this, parent, 'ProductPageMenu');
this.addLocationListener(BCWebsiteProductSubPagesLevel1.changeContext);
BCWebsiteProductSubPagesLevel1.parentColor = null;
this.setStyle({
display : 'none'
});
}
}
BCWebsiteProductSubPagesLevel1.prototype.load = function() {
if (this.activated()) {
this.draw();
}
else {
this.activate();
}
}
BCWebsiteProductSubPagesLevel1.prototype.draw = function() {
var parentPage = Kinky.site.childWidget('/' + this.getHash().split('/')[1] + '/' + this.getHash().split('/')[2]);
BCWebsiteProductSubPagesLevel1.parentColor = parentPage.data.graphicStyle.colors.blockGraphicalDefinition.text;
if (parentPage && parentPage.data && parentPage.data.pages) {
var parentImage = '';
for(var index in parentPage.data.graphicStyle.images){
if(parentPage.data.graphicStyle.images[index].stateCode == 'Menu Lateral'){
parentImage = parentPage.data.graphicStyle.images[index].fileInternalPath;
}
}
var parentImageWidget = new KImage(this, parentImage);
this.appendChild(parentImageWidget);
this.setStyle( {
display : 'block'
});
var pageData = new Object();
pageData.pages = parentPage.data.pages;
this.loadIndex(pageData);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.markIndex(this.getHash());
}
this.activate();
}
BCWebsiteProductSubPagesLevel1.prototype.loadIndex = function(page, level, topUL, parent) {
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
}
else {
if (level == 1) {
var li = window.document.createElement('li');
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
}
catch (e) {
dump(parent, false, true);
}
var a = window.document.createElement('a');
if (page.graphicStyle && page.graphicStyle.textImages && page.graphicStyle.textImages.pageMenuTitle) {
a.appendChild(KCSS.img(page.graphicStyle.textImages.pageMenuTitle.base, page.menuText, page.titleText));
} else {
a.appendChild(window.document.createTextNode(page.menuText));
}
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
this.subIndex[page.urlHashText] = li;
li.appendChild(a);
KSystem.addEventListener(li, 'mouseover', function(){
if (!(/KIndexMarked/.test(li.className))){
a.style.color = BCWebsiteProductSubPagesLevel1.parentColor;
}
});
KSystem.addEventListener(li, 'mouseout', function(){
if (!(/KIndexMarked/.test(li.className))){
a.style.color = '#919191';
}
});
topUL.appendChild(li);
}
}
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page);
}
}
BCWebsiteProductSubPagesLevel1.prototype.markIndex = function(hash) {
if (!hash) { return; }
var paths = hash.split('/');
paths.splice(0, 1);
for ( var level in this.lastMarked) {
this.removeCSSClass('KIndexMarked', this.lastMarked[level]);
this.lastMarked[level].childNodes[0].style.background = '';
}
this.lastMarked = {};
var subHash = '';
for ( var path in paths) {
subHash += '/' + paths[path];
if (!this.subIndex[subHash]) {
continue;
}
this.lastMarked[this.subIndex[subHash].name] = this.subIndex[subHash];
this.addCSSClass('KIndexMarked', this.subIndex[subHash]);
this.subIndex[subHash].style.background = BCWebsiteProductSubPagesLevel1.parentColor;
}
}
BCWebsiteProductSubPagesLevel1.changeContext = function(widget, hash) {
if (!(Kinky.site.childWidget(hash) instanceof BCWebsiteThreeColumnHighlight)){
widget.setStyle({
display : 'none'
});
return;
}else{
widget.setStyle({
display : 'block'
});
widget.refresh();
}
}
BCWebsiteProductSubPagesLevel2.prototype = new KIndex();
BCWebsiteProductSubPagesLevel2.prototype.constructor = BCWebsiteProductSubPagesLevel2;
function BCWebsiteProductSubPagesLevel2(parent) {
if (parent != null) {
KIndex.call(this, parent, 'ProductPageMenu');
this.addLocationListener(BCWebsiteProductSubPagesLevel2.changeContext);
this.liWidth = null;
this.setStyle({
display : 'none'
});
BCWebsiteProductSubPagesLevel2.parentColor = null;
}
}
BCWebsiteProductSubPagesLevel2.prototype.load = function() {
if (this.activated()) {
this.draw();
} else {
this.activate();
}
}
BCWebsiteProductSubPagesLevel2.prototype.draw = function() {
var parentPage = null;
var parentParentPage = null;
var h = this.getHash();
if(h) {
var parts = h.split('/');
parentPage = Kinky.site.childWidget('/' + parts[1] + '/' + parts[2] + '/' + parts[3]);
parentParentPage = Kinky.site.childWidget('/' + parts[1] + '/' + parts[2]);
}
if (parentParentPage) {
BCWebsiteProductSubPagesLevel2.parentColor = parentParentPage.data.graphicStyle.colors.blockGraphicalDefinition ? parentParentPage.data.graphicStyle.colors.blockGraphicalDefinition.text : '';
}
if (parentPage && parentPage.data && parentPage.data.pages) {
this.liWidth = 490 / parentPage.data.pages.length;
this.setStyle({
display : 'block'
});
var pageData = new Object();
pageData.pages = parentPage.data.pages;
this.loadIndex(pageData);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.markIndex(this.getHash());
}
this.activate();
}
BCWebsiteProductSubPagesLevel2.prototype.loadIndex = function(page, level, topUL, parent) {
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
} else {
if (level == 1) {
var li = window.document.createElement('li');
li.style.width = this.liWidth + 'px';
li.name = level;
try {
li.className = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
} catch (e) {
dump(parent, false, true);
}
if (level == 1) {
var leftDiv = window.document.createElement('div');
leftDiv.className = 'LeftBt';
var middleDiv = window.document.createElement('div');
middleDiv.className = 'MiddleBt';
var rightDiv = window.document.createElement('div');
rightDiv.className = 'RightBt';
}
var a = window.document.createElement('a');
KSystem.addEventListener(a, 'mouseover', function() {
var target = a;
if (target.parentNode.parentNode.alt != 1) {
target.style.color = BCWebsiteProductSubPagesLevel2.parentColor;
}
});
KSystem.addEventListener(a, 'mouseout', function() {
var target = a;
if (target.parentNode.parentNode.alt != 1) {
target.style.color = '';
}
});
if (page.graphicStyle && page.graphicStyle.textImages && page.graphicStyle.textImages.pageMenuTitle) {
a.appendChild(KCSS.img(page.graphicStyle.textImages.pageMenuTitle.base, page.menuText, page.titleText));
} else {
a.appendChild(window.document.createTextNode(page.menuText));
}
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
this.subIndex[page.urlHashText] = li;
middleDiv.appendChild(a);
li.appendChild(leftDiv);
li.appendChild(middleDiv);
li.appendChild(rightDiv);
topUL.appendChild(li);
}
}
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page);
}
}
BCWebsiteProductSubPagesLevel2.prototype.setMarked = function(hash) {
this.markIndex(hash);
};
BCWebsiteProductSubPagesLevel2.prototype.markIndex = function(hash) {
if (!hash) {
return;
}
var level = 1;
var subMenuColor1 = BCWebsiteProductSubPagesLevel2.parentColor;
var subMenuColor2 = '';
if (this.lastMarked[level] != null && this.lastMarked[level] != this.subIndex[hash]) {
this.lastMarked[level].alt = 0;
/*var target = this.lastMarked[level].childNodes[1].childNodes[0];
target.style.color = subMenuColor2;*/
}
KIndex.prototype.markIndex.call(this, hash);
if (this.lastMarked[level] != null) {
this.lastMarked[level].alt = 1;
var target = this.lastMarked[level].childNodes[1].childNodes[0];
target.style.color = subMenuColor1;
}
/*
var paths = hash.split('/');
paths.splice(0, 1);
for ( var level in this.lastMarked) {
this.removeCSSClass('KIndexMarked', this.lastMarked[level]);
this.lastMarked[level].childNodes[1].childNodes[0].style.color = '';
this.lastMarked[level].alt = 0;
}
this.lastMarked = {};
var subHash = '';
for ( var path in paths) {
subHash += '/' + paths[path];
if (!this.subIndex[subHash]) {
continue;
}
this.lastMarked[this.subIndex[subHash].name] = this.subIndex[subHash];
this.addCSSClass('KIndexMarked', this.subIndex[subHash]);
this.lastMarked[this.subIndex[subHash].name].alt = 1;
}*/
}
BCWebsiteProductSubPagesLevel2.changeContext = function(widget, hash) {
if (!(Kinky.site.childWidget(hash) instanceof BCWebsiteThreeColumnHighlight)) {
widget.setStyle({
display : 'none'
});
return;
} else {
widget.setStyle({
display : 'block'
});
widget.refresh();
}
}
BCWebsiteRightPanel.prototype = new KPanel();
BCWebsiteRightPanel.prototype.constructor = BCWebsiteRightPanel;
function BCWebsiteRightPanel(parent) {
if (parent != null) {
KPanel.call(this, parent);
this.hash = '/right-panel';
}
}
BCWebsiteRightPanel.prototype.draw = function() {
var highlightsContainer = new BCWebsiteHighlightsWidget(this);
this.appendChild(highlightsContainer);
var productContainer = new BCWebsiteProductHighlights(this);
productContainer.setTitle("Produtos Relacionados");
this.appendChild(productContainer);
KPanel.prototype.draw.call(this);
}
BCWebsiteSearchBox.prototype = new KForm();
BCWebsiteSearchBox.prototype.constructor = BCWebsiteSearchBox;
function BCWebsiteSearchBox(parent) {
if (parent != null) {
KForm.call(this, parent);
this.staticForm = true;
this.addQueryListener(BCWebsiteSearchBox.changeSearch, [ '/search/*' ]);
this.translations = null;
}
}
BCWebsiteSearchBox.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
this.setTitle(this.translations.searchTitle);
this.searchInput = new KInput(this, 'text', '', 'text');
this.searchInput.addValidator(/.+/, '');
this.searchInput.addCSSClass('SearchInput');
this.addInput(this.searchInput);
this.clearBoth();
var submitBt = new BCWebsiteKInput(this, this.translations.search, 'searchBt');
this.addInput(submitBt);
KForm.prototype.draw.call(this);
}
BCWebsiteSearchBox.prototype.onValidate = function(text, params, status) {
if (status) {
var query = '/search/' + encodeURIComponent(params.text);
KBreadcrumb.dispatchURL({
query : query
});
}
else {
for (var index in params) {
var input = params[index].getInput();
input.focus();
input.style.color = 'red';
}
}
return false;
}
BCWebsiteSearchBox.changeSearch = function(widget, query) {
var value = query.split('/')[2];
if (value && value != '')
widget.searchInput.setValue(value);
}
BCWebsiteSearchResults.prototype = new BCWebsiteKList();
BCWebsiteSearchResults.prototype.constructor = BCWebsiteSearchResults;
function BCWebsiteSearchResults(parent) {
if (parent != null) {
BCWebsiteKList.call(this, parent);
this.perPage = 10;
this.addQueryListener(BCWebsiteSearchResults.changeSearch, [ '/search/*' ]);
this.isPaginated = true;
this.totalResults = 0;
this.data = {};
this.translations = this.getParent('KPage').getTranslation(this.className);
}
}
BCWebsiteSearchResults.changeSearch = function(widget, query){
if (widget.activated() && (query.split('/')[2] != '')) {
widget.totalResults = 0;
widget.totalPages = 1;
widget.refresh();
}
}
BCWebsiteSearchResults.prototype.load = function() {
if (this.getQuery()) {
var queryArgs = this.getQuery().split('/');
this.data.feServiceArgs = {
args : {
text : queryArgs[2]
}
};
}else{
this.draw();
return;
}
KList.prototype.load.call(this);
}
BCWebsiteSearchResults.prototype.onLoad = function(data) {
this.data.items = data.searchResults;
this.data.searchQuery = data.searchQuery;
this.totalResults = data.totalResults;
this.setTotalPages(Math.ceil(this.totalResults / this.perPage), true);
this.draw();
}
BCWebsiteSearchResults.prototype.afterNext = function() {
if(this.totalResults == 0){
var noContent = new KText(this);
noContent.setText(this.translations.noContent);
this.appendChild(noContent);
}
if (this.totalPages <= 1){
this.setStyle( {
display : 'none'
}, KWidget.PAGINATION_DIV);
}
this.activate();
}
BCWebsiteSearchResults.prototype.draw = function() {
if (this.data.items && this.data.items.length > 0) {
var titleElements = new KText(this);
titleElements.setTitle(this.translations.searchResults + '
' + this.totalResults + ' ' + this.translations.resultsfound + '
', true);
titleElements.setText(this.data.searchQuery);
this.appendTitleChild(titleElements);
for ( var index in this.data.items) {
var item = new KPanel(this);
item.setTitle(this.data.items[index].resultTitle);
var itemLink = new BCWebsiteKButton(item, this.translations.more, 'link', function(e){
var widget = KSystem.getEventWidget(e);
KBreadcrumb.dispatchURL({
hash : widget.link.split('public/biocol')[1],
query : ''
});
});
itemLink.link = this.data.items[index].resultLink;
item.appendChild(itemLink);
this.appendChild(item);
}
}
BCWebsiteKList.prototype.draw.call(this);
if (!this.data.items || !(this.data.items.length > 0)){
this.setStyle({
display : 'none'
});
}
if (this.totalPages <= 1) {
this.setStyle( {
display : 'none'
}, KWidget.PAGINATION_DIV);
}else{
this.setStyle( {
display : 'block'
}, KWidget.PAGINATION_DIV);
}
}
BCWebsiteStoreFilter.prototype = new KForm();
BCWebsiteStoreFilter.prototype.constructor = BCWebsiteStoreFilter;
function BCWebsiteStoreFilter(parent) {
if (parent != null) {
KForm.call(this, parent);
this.translations = null;
}
}
BCWebsiteStoreFilter.prototype.load = function() {
var params = new Object();
if (this.data.feServiceArgs) {
KSystem.merge(params, this.data.feServiceArgs);
}
params.contentView = this.data.contentView;
params.contentID = this.data.contentID;
params.offset = this.nPage * this.perPage;
params.limit = this.perPage;
this.kinky.get(this, this.data.feService, params);
}
BCWebsiteStoreFilter.prototype.onLoad = function(data) {
if (!this.data){
this.data = {};
}
this.data.categories = data.categories;
this.data.districts = data.districts;
this.draw();
}
BCWebsiteStoreFilter.prototype.draw = function() {
this.translations = this.getParent('KPage').getTranslation(this.className);
this.setTitle(this.translations.title);
var districtCombo = new KCombo(this, this.translations.district, 'districtID');
for (var distIndex in this.data.districts){
districtCombo.addOption(this.data.districts[distIndex].regionID, this.data.districts[distIndex].name);
}
districtCombo.setStyle({
labelPosition : 'inside',
marginLeft: '168px'
});
this.addInput(districtCombo);
var productCombo = new KCombo(this, this.translations.product, 'categoryID');
for (var prodIndex in this.data.categories){
productCombo.addOption(this.data.categories[prodIndex].categoryID, this.data.categories[prodIndex].name);
}
productCombo.setStyle({
labelPosition : 'inside'
});
this.addInput(productCombo);
var allStores = new KCheckBox(this, '', 'allStores', true);
allStores.addOption(true, this.translations.allStores);
this.addInput(allStores);
this.clearBoth();
var submitBt = new BCWebsiteKInput(this, this.translations.search, 'searchBt');
this.addInput(submitBt);
KForm.prototype.draw.call(this);
}
BCWebsiteStoreFilter.prototype.onValidate = function(text, params, status) {
var query = '/store-filter';
if(params.allStores == 'true'){
query += '/all';
}else{
if (params.districtID && params.districtID != ''){
query += '/district/' + params.districtID;
}else if (params.categoryID && params.categoryID != ''){
query += '/category/' + params.categoryID;
}else{
query += '/all';
}
}
KBreadcrumb.dispatchURL({
query : query
});
return false;
}
BCWebsiteStoreList.prototype = new BCWebsiteKList();
BCWebsiteStoreList.prototype.constructor = BCWebsiteStoreList;
function BCWebsiteStoreList(parent) {
if (parent != null) {
BCWebsiteKList.call(this, parent);
this.perPage = 6;
this.addQueryListener(BCWebsiteStoreList.changeRegion, [ '/store-filter/*' ]);
this.isPaginated = true;
this.actualRegion = null;
this.waitForLoad = true;
this.translations = this.getParent('KPage').getTranslation(this.className);
}
}
BCWebsiteStoreList.changeRegion = function(widget, query) {
this.actualRegion = null;
if (widget.activated()) {
// widget.parent.mapContainer.setStyle({
// visibility : 'visible'
// });
widget.refresh();
}
};
BCWebsiteStoreList.prototype.load = function() {
if (this.getQuery()) {
var queryArgs = this.getQuery().split('/');
for ( var index in queryArgs) {
var indexInt = parseInt(index);
if (queryArgs[indexInt] == 'category' && queryArgs[indexInt + 1] != '') {
this.data.feServiceArgs.config.categoryID = queryArgs[indexInt + 1];
}
if (queryArgs[indexInt] == 'district' && queryArgs[indexInt + 1] != '') {
this.data.feServiceArgs.config.regionID = queryArgs[indexInt + 1];
}
if (queryArgs[indexInt] == 'all') {
this.data.feServiceArgs.config.categoryID = null;
this.data.feServiceArgs.config.regionID = null;
break;
}
}
} else {
this.draw();
return;
}
this.data.feServiceArgs.config.stateID = this.data.config.stateID;
BCWebsiteKList.prototype.load.call(this);
};
BCWebsiteStoreList.prototype.onLoad = function(data) {
BCSite.mapWindowDialog.data = this.data;
this.data.items = data.items;
this.setTotalPages((Math.ceil(data.items.length / this.perPage)), true);
this.draw();
};
BCWebsiteStoreList.prototype.afterNext = function() {
if ((this.data.items.length / this.perPage) <= 1){
this.setStyle({
display : 'none'
}, KWidget.PAGINATION_DIV);
}
if (!(this.data.items.length > 0)){
var noContent = new KText(this);
noContent.setText(this.translations.noContent);
this.appendChild(noContent);
// this.parent.mapContainer.setStyle({
// visibility : 'hidden'
// });
}
};
BCWebsiteStoreList.prototype.draw = function() {
// var googleMap = this.parent.googleMap;
if (this.data.items && this.data.items.length > 0) {
this.titleElements = new KText(this);
this.titleElements.setTitle(this.translations.searchResults + '
' + this.data.items.length + ' ' + this.translations.resultsfound + '
', true);
this.appendTitleChild(this.titleElements);
var first = true;
for ( var index in this.data.items) {
var item = new KText(this);
{
if (this.data.items[index].regionName != this.actualRegion && !(/district/.test(this.getQuery()))) {
item.setTitle('\u2022 ' + this.data.items[index].regionName);
this.actualRegion = this.data.items[index].regionName;
this.titleElements.setText(this.translations.all);
} else {
item.setStyle({
display : 'none'
}, KWidget.TITLE_DIV);
this.titleElements.setText(this.data.items[index].regionName);
}
if (this.data.items[index].name) {
item.appendText('
' + this.translations.name + '
' + this.data.items[index].name + '');
}
if (this.data.items[index].address) {
item.appendText('
' + this.translations.address + '
' + this.data.items[index].address + '');
}
if (this.data.items[index].telephone) {
item.appendText('
' + this.translations.telephone + '
' + this.data.items[index].telephone + '');
}
if (this.data.items[index].fax) {
item.appendText('
' + this.translations.fax + '
' + this.data.items[index].fax + '');
}
if (this.data.items[index].schedule) {
item.appendText('
' + this.translations.schedule + '
' + this.data.items[index].schedule + '');
}
//nao descomentar ja estava item.data.id = this.data.items[index].locationID;
item.data.pointInfo = this.data.items[index];
// item.addEventListener('mouseover', function(e) {
// if (googleMap && googleMap.activated() && googleMap.map) {
// var widget = KSystem.getEventWidget(e);
// BCSite.mapWindowDialog.currentPointInfo = widget.data.pointInfo;
// eval('coordinate = new google.maps.LatLng(' + widget.data.pointInfo.coordinate + ');');
//
// googleMap.map.setCenter(coordinate);
// }
// });
if (this.data.items[index].image) {
var itemPhoto = new KImage(item, this.data.items[index].image);
item.appendChild(itemPhoto);
itemPhoto.go();
}
}
this.appendChild(item);
}
}
BCWebsiteKList.prototype.draw.call(this);
if (!this.data.items || !(this.data.items.length > 0)) {
this.setStyle({
display : 'none'
});
// this.parent.mapContainer.setStyle({
// visibility : 'hidden'
// });
} else {
// this.placePoints();
}
};
BCWebsiteStoreList.prototype.placePoints = function() {
var googleMap = this.parent.googleMap;
if (googleMap && googleMap.activated() && googleMap.map) {
for ( var index = this.data.items.length - 1; index != -1; --index) {
var coordinate = null;
eval('coordinate = new google.maps.LatLng(' + this.data.items[index].coordinate + ');');
var mapPoint = new Object();
mapPoint.coordinate = this.data.items[index].coordinate;
mapPoint.local = '';
mapPoint.city = '';
mapPoint.address = '';
if (this.data.items[index].designation)
mapPoint.designation = this.data.items[index].designation;
else
mapPoint.designation = '';
googleMap.placeMarker(coordinate, false, false, mapPoint);
}
} else {
KSystem.addTimer('Kinky.getWidget(\'' + this.id + '\').placePoints()', 800);
}
};
BCWebsiteTopMenu.prototype = new KIndex();
BCWebsiteTopMenu.prototype.constructor = BCWebsiteTopMenu;
function BCWebsiteTopMenu(parent, id, data) {
if (parent) {
KIndex.call(this, parent, id, data);
this.changeMenuIndex = 0;
}
}
BCWebsiteTopMenu.prototype.setMarked = function(hash) {
this.markIndex(hash);
}
BCWebsiteTopMenu.prototype.draw = function() {
this.changeMenuIndex = Math.round(this.data.pages.length / 2);
this.loadIndex(this.data);
for ( var element in this.childWidgets()) {
this.childWidget(element).go();
}
this.activate();
this.markIndex(this.getHash());
}
BCWebsiteTopMenu.prototype.loadIndex = function(page, level, topUL, parent, pageIndex) {
if (!pageIndex) {
pageIndex = 1;
}
var ul = null;
if (level == null) {
if (this.topUL == null) {
this.topUL = window.document.createElement('ul');
this.topUL.className = 'KIndexLevel1';
this.topUL.id = this.hash;
this.content.appendChild(this.topUL);
}
ul = topUL = this.topUL;
level = 0;
for ( var index in page.pages) {
this.loadIndex(page.pages[index], level + 1, ul, page, pageIndex++);
}
} else {
if (level == 1) {
if (page.urlHashText == '/map'){
return;
}
if(page.template == 12) {
BCMicroSite.productPageHash = page.urlHashText;
}
var li = window.document.createElement('li');
var liClassName = 'KIndexLevelItem' + level + ' KIndex' + page.urlHashText.replace(/\//g, '_').toUpperCase();
if (page.urlHashText != '/newsletter'){
liClassName += ' Special';
}
li.name = level;
try {
li.className = liClassName;
li.id = page.urlHashText.replace(/\//g, '_').toUpperCase();
} catch (e) {
dump(parent, false, true);
}
var background = window.document.createElement(this.tagNames[Kinky.HTML_READY][KWidget.BACKGROUND_DIV]);
background.id = li.id + '_background';
background.className = ' KWidgetPanelBackground MainLinkBackground ';
background.style.position = 'absolute';
li.appendChild(background);
var leftDiv = window.document.createElement('div');
leftDiv.className = 'MainLinkLeft';
var middleDiv = window.document.createElement('div');
middleDiv.className = 'MainLinkMiddle';
var rightDiv = window.document.createElement('div');
rightDiv.className = 'MainLinkRight';
background.appendChild(leftDiv);
background.appendChild(middleDiv);
background.appendChild(rightDiv);
var contentContainer = window.document.createElement(this.tagNames[Kinky.HTML_READY][KWidget.CONTAINER_DIV]);
contentContainer.className = ' KWidgetPanelContentContainer MainLinkContentContainer ';
contentContainer.style.clear = 'both';
contentContainer.style.position = 'relative';
li.appendChild(contentContainer);
var a = window.document.createElement('a');
contentContainer.appendChild(a);
if (page.graphicStyle && page.graphicStyle.textImages && page.graphicStyle.textImages.pageMenuTitle) {
a.appendChild(KCSS.img(page.graphicStyle.textImages.pageMenuTitle.base, page.menuText, page.titleText));
} else {
a.appendChild(window.document.createTextNode(page.menuText));
}
a.href = (/http:/.test(page.urlHashText) ? '' : '#') + page.urlHashText;
a.target = (/http:/.test(page.urlHashText) ? '_blank' : '_self');
topUL.appendChild(li);
this.subIndex[page.urlHashText] = li;
}
}
};
BCWebsiteFooterMenu.prototype.loadTranslations = function() {
this.widget_translations = {
'BCWebsiteFooterMenu' : {
rightsText : 'Todos os direitos reservados \u00e0
Biocol S.A. 2011'
}
};
};
BCWebsiteKList.prototype.loadTranslations = function() {
this.widget_translations = {
'BCWebsiteKList' : {
previousPage : 'P\u00e1g. Anterior',
nextPage : 'P\u00e1g. Seguinte'
}
};
};
BCWebsitePressRelease.prototype.loadTranslations = function() {
this.translations = {
'BCPressList' : {
download : 'Download',
noContent : 'N\u00e3o existem conte\u00fados a apresentar.'
}
};
}
BCContact.prototype.loadTranslations = function() {
this.translations = {
'BCFormContact' : {
name : 'Nome *',
email : 'E-Mail *',
phone : 'Telefone',
message : 'Mensagem *',
submit : 'SUBMETER',
mandatoryFields : '* Campos obrigat\u00f3rios',
successTitle : 'SUCESSO',
successText : 'Mensagem enviada com sucesso. Obrigada pelo contacto.',
successButton : 'FECHAR',
errorTitle : 'ERRO',
errorText : 'Ocorreu um erro no envio do pedido de contacto. Pedimos desculpa.',
errorButton : 'TENTAR NOVAMENTE'
}
};
}
BCContestDetail.prototype.loadTranslations = function() {
this.translations = {
'BCContestDetail' : {
participate : 'PARTICIPAR'
}
};
};
BCContestParticipate.prototype.loadTranslations = function() {
this.translations = {
'BCContestForm' : {
name : 'Nome',
email : 'E-Mail',
phone : 'Telefone',
answer : 'Resposta',
submit : 'SUBMETER',
biocolNewsletter : 'Quero receber a Newsletter da BIOCOL',
termsText : 'Concordo com os Termos & Condi\u00e7\u00f5es',
answerTitle : 'Pergunta',
dataTitle : 'Formul\u00e1rio',
successTitle : 'SUCESSO',
successText : 'A tua participa\u00e7\u00e3o no passatempo foi enviada com sucesso.',
successButton : 'FECHAR',
errorTitle : 'ERRO',
errorText : 'Ocorreu um erro e n\u00e3o nos foi poss\u00edvel receber a tua participa\u00e7\u00e3o no passatempo.',
errorButton : 'TENTAR NOVAMENTE'
}
};
};
BCContestWinners.prototype.loadTranslations = function() {
this.translations = {
'BCContestWinnersList' : {
winnerName : 'Vencedores',
winnerText : 'Frase'
}
};
};
BCFaq.prototype.loadTranslations = function() {
this.translations = {
'BCMappedList' : {
btBack : 'topo',
noContent : 'N\u00e3o existem conte\u00fados a apresentar.'
}
};
};
BCLocationMap.prototype.loadTranslations = function() {
this.translations = {
'BCMapGridList' : {
fax : 'Fax.',
telephone : 'Tel.',
schedule : 'Hor\u00e1rio.'
}
};
};
BCMicroSite.prototype.loadTranslations = function() {
this.translations = {
buttonLabel : 'FECHAR'
};
}
BCNews.prototype.loadTranslations = function() {
this.translations = {
'BCList' : {
readMore : 'LER MAIS',
close : 'FECHAR',
noContent : 'N\u00e3o existem conte\u00fados a apresentar.'
}
};
};
BCNewsletter.prototype.loadTranslations = function() {
this.translations = {
name : 'Nome',
email : 'E-mail',
biocol : 'Quero receber a Newsletter da BIOCOL',
submit : 'SUBSCREVER',
successTitle : 'SUCESSO',
successText: 'Subscri\u00e7\u00e3o efectuada com sucesso.',
successButton : 'FECHAR',
errorTitle: 'ERRO',
errorText: 'Ocorreu um erro na subscri\u00e7\u00e3o.',
errorButton : 'TENTAR NOVAMENTE'
};
};
BCProductHighlight.prototype.loadTranslations = function() {
this.translations = {
title : 'Produtos Relacionados'
};
};
BCTips.prototype.loadTranslations = function() {
this.translations = {
'BCList' : {
noContent : 'N\u00e3o existem conte\u00fados a apresentar.'
}
};
};
BCWebsiteContact.prototype.loadTranslations = function() {
this.translations = {
'BCWebsiteFormContact' : {
firstName : '
* Primeiro Nome',
firstNameError : 'Insira o seu Primeiro Nome',
lastName : '
* \u00daltimo Nome',
lastNameError : 'Insira o seu \u00daltimo Nome',
email : '
* E-mail de contacto',
emailError : 'o email foi introduzido incorrectamente',
phone : '
* Nr de contacto',
phoneError : 'Insira o seu N\u00famero de Telefone',
mandatoryFields : '* Campos obrigat\u00f3rios',
message : '
* Mensagem',
messageError : 'Insira a sua Mensagem',
submit : 'Enviar',
successTitle : 'Sucesso',
successText : 'O seu formul\u00e1rio de contacto foi enviado com sucesso.',
errorTitle : 'Erro',
errorText : 'Ocorreu um erro e n\u00e3o nos foi poss\u00edvel receber o seu formul\u00e1rio de contacto.'
}
};
}
BCWebsiteExport.prototype.loadTranslations = function() {
this.translations = {
'BCWebsiteFormContact' : {
firstName : '
* Primeiro Nome',
firstNameError : 'Insira o seu Primeiro Nome',
lastName : '
* \u00daltimo Nome',
lastNameError : 'Insira o seu \u00daltimo Nome',
email : '
* E-mail de contacto',
emailError : 'o email foi introduzido incorrectamente',
phone : '
* Nr de contacto',
phoneError : 'Insira o seu N\u00famero de Telefone',
mandatoryFields : '* Campos obrigat\u00f3rios',
message : '
* Mensagem',
messageError : 'Insira a sua Mensagem',
submit : 'Enviar',
successTitle : 'Sucesso',
successText : 'O seu formul\u00e1rio de contacto foi enviado com sucesso.',
errorTitle : 'Erro',
errorText : 'Ocorreu um erro e n\u00e3o nos foi poss\u00edvel receber o seu formul\u00e1rio de contacto.'
},
'BCWebsiteExportMap' : {
'south-america' : 'America do Sul',
'north-america' : 'America do Norte',
'asia' : 'Asia',
'europe' : 'Europa',
'oceania' : 'Oceania',
'africa' : 'Africa'
}
};
}
BCWebsiteHomepage.prototype.loadTranslations = function() {
this.translations = {
'BCHomepageHighlights' : {
wizardBt : 'Descubra aqui o produto ideal para si',
highlightTitle : 'Produtos em Destaque',
more : 'Saber mais'
},
'BCNewsMarquee' : {
newsTitle : 'Novidades'
},
'BCNewsHighlights' : {
newsTitle : 'Not\u00edcias',
seeAll : 'Ver todas',
more : 'Ver mais'
},
'BCFacebookShare' : {
shareTitle : 'Partilhe no Facebook',
share : 'Partilhar'
}
};
}
BCWebsiteNews.prototype.loadTranslations = function() {
this.translations = {
'BCWebsiteList' : {
readMore : 'Ler mais',
close : 'Fechar',
noContent : 'N\u00e3o existem conte\u00fados a apresentar.',
previous : 'Pag. Anterior',
next : 'Pag. Seguinte'
}
};
}
BCWebsiteNewsletter.prototype.loadTranslations = function() {
this.translations = {
name : 'Nome',
email : 'Email',
dataTitle : 'Insira o seu nome e e-mail:',
categoriesTitle : 'Eu quero receber novidades de:',
submit : 'Subscrever',
successTitle : 'Sucesso',
errorTitle: 'Erro',
successText: 'Subscreveste a nossa newsletter com sucesso.',
errorText: 'Ocorreu um erro e n\u00e3o foi poss\u00edvel subscreveres a newsletter.'
};
}
BCWebsiteOpportunity.prototype.loadTranslations = function() {
this.translations = {
'BCWebsiteAccordionList' : {
opportunityList : 'Lista de Oportunidades',
applyHere : 'Fa\u00e7a aqui a sua candidatura',
applyOpportunity : 'Candidatar'
},
'BCWebsiteJobForm' : {
formTitle : 'Candidatura espont\u00e2nea',
backToTop: 'Voltar ao topo',
name : '
* Nome',
nameError : 'Insira o seu Nome',
email : '
* E-mail de contacto',
emailError : 'o email foi introduzido incorrectamente',
phone : '
* Telefone',
phoneError : 'Insira o seu N\u00famero de Telefone',
cv : '* Carregar CV',
cvError : 'Insira o seu CV',
mandatoryFields : '* Campos obrigat\u00f3rios',
message : '
* Mensagem',
messageError : 'Insira a sua Mensagem',
submit : 'Enviar',
successTitle : 'Sucesso',
successText : 'A sua candidatura foi enviada com sucesso.',
errorTitle : 'Erro',
errorText : 'Ocorreu um erro e n\u00e3o nos foi poss\u00edvel receber a sua candidatura.'
}
};
}
BCWebsitePressRelease.prototype.loadTranslations = function() {
this.translations = {
'BCPressList' : {
download : 'Download',
noContent : 'N\u00e3o existem conte\u00fados a apresentar.'
}
};
}
BCWebsiteSearch.prototype.loadTranslations = function() {
this.translations = {
'BCWebsiteSearchBox' : {
searchTitle : 'Pesquisa',
search : 'Pesquisar'
},
'BCWebsiteSearchResults' : {
searchResults : 'Resultados da Pesquisa',
resultsfound : 'resultados encontrados',
more : 'Ver mais',
noContent : 'N\u00e3o foram encontrados resultados.'
}
};
}
BCWebsiteStoreFinder.prototype.loadTranslations = function() {
this.translations = {
'BCWebsiteStoreFilter' : {
title : 'Filtre a sua pesquisa por:',
district : 'Localidade',
product : 'Produto',
allStores : 'Todas as lojas',
search : 'Pesquisar'
},
'BCWebsiteStoreList' : {
name : 'Nome',
address : 'Morada:',
telephone : 'Telefone:',
fax : 'Fax:',
schedule : 'Hor\u00e1rio de abertura:',
all : '> Todas as Localidades',
searchResults : 'Resultados da Pesquisa',
resultsfound : 'resultados encontrados',
noContent : 'N\u00e3o foram encontrados resultados.'
}
};
}
function load() {
Kinky.SERVICES_URL = 'http://www.dieteffect.pt/ui/proxy.php';
Kinky.GOOGLE_ANALYTICS = 'UA-1573854-68';
Kinky.SITE_URL = 'http://www.dieteffect.pt/';
Kinky.SITE_CSS_URL = Kinky.SITE_URL + 'ui/styles/';
Kinky.DATA_URL = Kinky.SITE_URL + 'cache/';
Kinky.HOMEPAGE_URL = '/homepage';
Kinky.BASE_VERSION = '/dieteffect';
var prefix = window.document.location.href.split('#')[0].replace(Kinky.SITE_URL, '').split('/');
if (prefix != '') {
Kinky.DEFAULT_LANG = prefix[0];
}
else {
Kinky.DEFAULT_LANG = 'pt';
}
Kinky.BASE_JS_URL = 'http://www.dieteffect.pt/ui/';
Kinky.BASE_TEMP_DIR = '/dados/sites/biocol/www/temp/';
Kinky.BASE_TEMP_URL = '/dados/sites/biocol/www/temp/';
Kinky.BASE_SERVICE = 'php:Frontend:Website';
Kinky.BASE_SERVICE = 'js:structure/' + Kinky.DEFAULT_LANG + '/public' + Kinky.BASE_VERSION + ':info';
Kinky.SERVICE_NAMESPACE = Kinky.BASE_SERVICE.split(':')[0];
Kinky.BASE_CONTENT_SERVICE = 'php:Frontend:GetContent';
Kinky.BASE_CONTENT_SERVICE = 'js:data/' + Kinky.DEFAULT_LANG + '/public/:info.json';
Kinky.BASE_CLASS = 'BCMicroSite';
Kinky.BASE_TAG = 'contentDiv';
Kinky.AUTOLOAD_PAGE = true;
//Kinky.DEFAULT_USER = 'admin';
//Kinky.DEFAULT_USER_SECRET = SHA1('zeroeum');
Kinky.SHOW_INSTANTIATIONS_ERRORS = 'dump';
KCaptcha.CAPTCHA_SERVICE_URL = Kinky.BASE_JS_URL + 'captchaCreate.php';
Kinky.DEV_MODE = true;
Kinky.ALLOW_EFFECTS = true;
KCSS.NO_IE_OPACITY = true;
Kinky.config();
}
if (window.attachEvent) {
window.attachEvent('onload', load);
}
else {
window.addEventListener('load', load, false);
}