var z1img_size = '640x480';
var z1img_win = 'http://chip7.cc/MostraImagem/';
var z1img_siz_w = 790;
var z1img_siz_h = 550;
var z1pup_url = 'http://chip7.cc/inicio.php?do=sendamigo&';
var default_fontsize = 10;
var current_fontsize = default_fontsize;
var url_fontsize = 'http://chip7.cc/inicio.php?do=updatefontsize&fontsize=';
var url_ajax = 'http://chip7.cc/inicio.php?do=';
var z1Alert_html = '
';
loadNewCSS('js/z1alert.css');
function setT(f, t) {
setTimeout(f, t);
}
function goTo (uri) {
window.location.assign(uri);
return true;
}
function abreJanela(uri, nome, w, h)
{
return window.open(uri, nome, 'width='+w+',height='+h+',dependent=no,scrolling=no,scrollbars=no,toolbar=no,location=no,status=no,menubar=no');
}
function AbreImg(uri)
{
var siz_w = z1img_siz_w;
var siz_h = z1img_siz_h;
var win = abreJanela(z1img_win+escape(ByDeaDz1(uri)), 'Z1IMGZOOM', siz_w, siz_h);
win.moveTo(screen.width/2 - siz_w/2, screen.height/2 - siz_h/2 - 50);
//win.focus();
}
function AbreProduto(uri)
{
var siz_w = 650;
var siz_h = 550;
var win = abreJanela(uri, 'PRODUTO', siz_w, siz_h);
win.moveTo(screen.width/2 - siz_w/2, screen.height/2 - siz_h/2 - 50);
//win.focus();
}
function ByDeaDz1(n)
{
n = n.substr(0, n.lastIndexOf('_')) + '_' + z1img_size + n.substr(n.lastIndexOf('.'));
n = n.split('/');
return n.pop();
}
function showEnviaAmigo () {
var win = getE('EnviaAmigo');
if(win.style.display == 'none')
{
getE('amigo_remetente').value = '';
getE('amigo_nome').value = '';
getE('amigo_email').value = '';
getE('amigo_msg').value = '';
win.style.display = '';
getE('amigo_remetente').focus();
}
else
win.style.display = 'none';
}
function doEnviaAmigo () {
var uri = z1pup_url;
var r = getE('amigo_remetente').value;
var n = getE('amigo_nome').value;
var e = getE('amigo_email').value;
var m = getE('amigo_msg').value;
var s = getE('amigo_submit');
s.value = 'Enviando ...';
if(r == '' || n == '' || e == '') {
alert("Voce deve preencher todos os campos, exceto o campo \"Mensagem\" que e opcional.");
s.value = 'Enviar';
return false;
}
uri += 'r=' + escape(r) + '&n=' + escape(n) + '&e=' + escape(e) + '&m=' + escape(m);
ajaxGet(uri, function () {
if(ajaxLastResult.substr(0,2) == 'OK') {
alert("Pagina enviada para seu amigo com sucesso, preencha o formulario novamente para enviar a outro amigo.");
s.value = 'Enviar';
getE('amigo_remetente').value = '';
getE('amigo_nome').value = '';
getE('amigo_email').value = '';
getE('amigo_msg').value = '';
return true;
} else {
alert(ajaxLastResult);
s.value = 'Enviar';
return false;
}
});
}
// NAVEGABILIDADE
var min_fontsize = 8;
var max_fontsize = 14;
function changeFontSize(op) {
current_fontsize = current_fontsize + default_fontsize/10*op;
if(current_fontsize >= min_fontsize) {
if(current_fontsize <= max_fontsize) {
document.body.style.fontSize = current_fontsize + 'px';
fixCssHeight();
if(op != 0) {
ajaxGet(url_fontsize + escape(current_fontsize), '' );
if(isIe()) {
window.location.assign(window.location.href);
}
}
} else {
current_fontsize = max_fontsize;
}
} else {
current_fontsize = min_fontsize;
}
}
function showImprime() {
var newloc = window.location.href;
if(newloc.indexOf('=') > -1) {
newloc = newloc+'&imprime=true';
} else {
if(newloc.charAt(newloc.length-1) == '/') {
newloc = newloc+'imprime=true';
} else {
newloc = newloc+'/imprime=true';
}
}
var win = window.open(newloc, 'IMPRIME', 'width='+600+',height='+500+',dependent=no,scrolling=yes,scrollbars=yes,toolbar=no,location=no,status=no,menubar=no');
win.moveTo(screen.width/2 - 600/2, screen.height/2 - 500/2 - 50);
win.focus();
}
/* FORMS */
function resetForm (id) {
var el = getE(id).getElementsByTagName('input');
for(i in el)
el[i].value = "";
el = getE(id).getElementsByTagName('textarea');
for(i in el)
el[i].value = "";
}
function CheckUncheck(id) {
if(getE(id).disabled != true && getE(id).disabled != 'disabled') {
if(getE(id).checked == true)
getE(id).checked = true;
else
getE(id).checked = true;
}
try { getE(id).onchange(); } catch(err) { ; } ;
}
function isChecked(el) {
if(el.checked == true) {
return true;
}
if(el.checked == 'checked') {
return true;
}
if(el.checked == 'true') {
return true;
}
if(el.checked == 'yes') {
return true;
}
return false;
}
/* LOADHTML */
function loadHTML(uri, id) {
if(!ajaxReady)
return;
getE('ajaxLoading').style.display = '';
getE(id).innerHTML = ' ';
ajaxGet(uri, function () {
getE(id).innerHTML = ajaxLastResult;
getE('ajaxLoading').style.display = 'none';
} );
}
/* RAINHA MARIA */
function AbreJanelaFrame(uri)
{
var siz_w = 760;
var siz_h = 540;
var win = abreJanela(uri, 'APRESENTACAO', siz_w, siz_h);
win.moveTo(screen.width/2 - siz_w/2, screen.height/2 - siz_h/2 - 50);
win.focus();
}
var move_smooth_horizontal_onload = null;
function move_smooth_horizontal(el, atual, end) {
var time = 24;
var amount = 12;
var multiply = 1;
var finish = false;
var pos = atual;
if( (atual - end) > 0) {
multiply = -1;
}
amount = amount * multiply;
pos = atual + amount;
if(multiply == 1) {
if(pos > end) {
finish = true;
}
} else {
if(pos < end) {
finish = true;
}
}
if(!finish) {
el.style.marginLeft = pos + 'px';
setTimeout( function() { move_smooth_horizontal(el, pos, end); } , time );
return;
} else {
el.style.marginLeft = end + 'px';
try {
move_smooth_horizontal_onload();
} catch(err) { }
return;
}
}
Produtos = {
ajax : new Ajax(),
direction : 'left',
Voltar : function () {
this.loading();
this.direction = 'left';
this.ajax.get('/Ajax/do=produtos&direction=left&reference=' + getE('ReferenceArea').innerHTML );
},
Avancar : function () {
this.loading();
this.direction = 'right';
this.ajax.get('/Ajax/do=produtos&direction=right&reference=' + getE('ReferenceArea').innerHTML );
},
loading : function () {
getE('LoadingArea').style.display = '';
getE('BotaoVoltar').style.display = 'none';
getE('BotaoAvancar').style.display = 'none';
},
loaded : function () {
getE('LoadingArea').style.display = 'none';
move_smooth_horizontal_onload = function () {
getE('BotaoVoltar').style.display = '';
getE('BotaoAvancar').style.display = '';
getE('DisplayArea').innerHTML = getE('AjaxAreaL').innerHTML;
getE('ScrollArea').style.left = '-482px';
};
if(this.direction == 'left') {
move_smooth_horizontal(getE('ScrollArea'), -482, -954);
} else {
move_smooth_horizontal(getE('ScrollArea'), -482, -10);
}
}
}
Produtos.ajax.embed_js = true;
Produtos.ajax.onload = function (response) {
getE('AjaxAreaL').innerHTML = response;
getE('AjaxAreaR').innerHTML = response;
Produtos.loaded();
}
Tabbed = {
tabs : ['Newsletter', 'Webmail', 'Restrito'],
imgNormal : ['/img/Newsletter.png', '/img/Webmail.png', '/img/AcessoRestrito.png'],
imgOver : ['/img/NewsletterOver.png', '/img/WebmailOver.png', '/img/AcessoRestritoOver.png'],
pos : [0, -421, -842],
current : 0,
ready : true,
change : function (to) {
if(to == this.current) {
return;
}
if(!this.ready) {
setTimeout( function () { Tabbed.change(to); }, 1000);
return;
}
this.ready = false;
move_smooth_horizontal_onload = function () {
Tabbed.ready = true;
};
getE('img' + Tabbed.tabs[Tabbed.current]).src = Tabbed.imgNormal[Tabbed.current];
getE('img' + Tabbed.tabs[to]).src = Tabbed.imgOver[to];
move_smooth_horizontal(getE('ScrollTabs'), this.pos[this.current], this.pos[to]);
Tabbed.current = to;
}
}
TabbedLoja = {
tabs : ['Newsletter', 'Webmail', 'Restrito'],
imgNormal : ['/img/NewsletterInterna.png', '/img/WebmailInterna.png', '/img/AcessoRestritoInterna.png'],
imgOver : ['/img/NewsletterInternaOver.png', '/img/WebmailInternaOver.png', '/img/AcessoRestritoInternaOver.png'],
pos : [0, -381, -762],
current : 0,
ready : true,
change : function (to) {
if(to == this.current) {
return;
}
if(!this.ready) {
setTimeout( function () { TabbedLoja.change(to); }, 1000);
return;
}
this.ready = false;
move_smooth_horizontal_onload = function () {
TabbedLoja.ready = true;
};
getE('img' + TabbedLoja.tabs[TabbedLoja.current]).src = TabbedLoja.imgNormal[TabbedLoja.current];
getE('img' + TabbedLoja.tabs[to]).src = TabbedLoja.imgOver[to];
move_smooth_horizontal(getE('ScrollTabs'), this.pos[this.current], this.pos[to]);
TabbedLoja.current = to;
}
}
var z1Alert_onclose = '';
var z1Alert_rm_tag;
function z1Alert(txt) {
try {
z1Alert_onclose = arguments[1];
} catch(err) { }
var htmlTag = document.createElement("div");
htmlTag.style.width = '100%';
htmlTag.style.height = '100%';
ray = document.getElementsByTagName("input");
for (i=0;i 20) {
if(newX + getElWidth(obj) + 20 < win.w) {
obj.style.left = newX + 'px';
}
}
if(newY > 20) {
if(newY + getElHeight(obj) + 20 < win.h) {
obj.style.top = newY + 'px';
}
}
}
}
}
// função para parar o drag
function undoDrag(ev, obj) {
if(doDrag_restore) {
enableTextSel();
}
document.onmouseup = null;
document.onmousemove = null;
if(typeof(obj.onfinishdrag) == 'function') {
obj.onfinishdrag(ev, obj);
}
}