var is_ie = !(navigator.appName.indexOf("Netscape") != -1);
function gen_popup(src, width, height, page_header) {
if(!page_header)
page_header = "";
win = window.open("", "_blank", "width=" + (width) + ",height=" + (height) + ",titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no");
win.document.write("
" + page_header + "");
win.document.write("<" + "script" + ">document.title = \"" + page_header + "\";\r\nfunction _CloseOnEsc(e) {if(e){ event = e;} if (event.keyCode == 27) { window.close(); return; }} document.onkeydown = _CloseOnEsc;<" + "/script>");
win.document.write(" ");
win.document.write(" |
");
return false;
}
document.onkeydown = function(e) {
var is_ie = !(navigator.appName.indexOf("Netscape") != -1);
if(!is_ie)
event = e;
if(event.keyCode == 27)
quickHide();
if (event.shiftKey && event.keyCode == 68)
quickEdit();
if(event.ctrlKey && event.keyCode == 37) {
obj = document.getElementById('umicut_toprev');
if(obj) {
document.location = obj.toString();
}
}
if(event.ctrlKey && event.keyCode == 39) {
obj = document.getElementById('umicut_tonext');
if(obj) {
document.location = obj.toString();
}
}
if(event.ctrlKey && event.keyCode == 36) {
obj = document.getElementById('umicut_tobegin');
if(obj) {
document.location = obj.toString();
}
}
if(event.ctrlKey && event.keyCode == 35) {
obj = document.getElementById('umicut_toend');
if(obj) {
document.location = obj.toString();
}
}
return true;
}
var last_src = "";
function cms_vote_dPostH(dImg) {
/*
iWidth = dImg.width;
iHeight = dImg.height;
dImg.style.display = 'none';
if(iWidth == 2 && iHeight == 2) { //posted. all is ok.
}
if(iWidth == 1 && iHeight == 1) { //posted. all is ok.
alert("Ваше мнение учтено.");
}
if(iWidth == 2 && iHeight == 1) { //posted. posts limit.
alert("Вы уже голосовали недавно.");
}
if(iWidth == 1 && iHeight == 2) { //no poll, or one is closed for posts.
alert("Голосование закрыто.");
}
dImg.style.display = '';
*/
}
/*
function cms_vote_postDo(formName, inputName) {
fObj = document.forms[formName];
eval('iObj = fObj.' + inputName + ';');
res = false;
for(i = 0; i < iObj.length; i++)
if(iObj[i].checked)
res = iObj[i].value;
if(res)
pUrl = "/vote/post/" + res + "/";
else
return false;
pImg = document.getElementById('cms_vote_pImg');
if(!pImg)
return false;
// if(!(last_src == pUrl))
pImg.src = pUrl;
last_src = pUrl;
}
*/
function cms_vote_postDo(formName, inputName, nstext) {
fObj = document.forms[formName];
if(!fObj)
return false;
eval('iObj = fObj.' + inputName + ';');
if(!iObj)
return false;
res = false;
for(i = 0; i < iObj.length; i++)
if(iObj[i].checked)
res = iObj[i].value;
if(res) {
sc = document.createElement("script");
sc.src = "/vote/post/" + res + "/?m=" + new Date().getTime();
// sc.src = "/classes/vote/d.js?m=" + new Date().getTime();
// sc.src = "/vote/post/" + res + "/";
//alert(sc);
fObj.appendChild(sc);
} else {
if(nstext) {
alert(nstext);
}
}
}
function quickEdit() {
if(!qedit_allowed)
return true;
obj = document.getElementById('quickEdit');
if(!obj)
return false;
options = "";
for(i = 0; i < quickUrls.length; i++) {
qName = quickUrls[i][0];
qUrl = quickUrls[i][1];
if(qName && qUrl)
options += "» " + qName + "
\r\n";
}
html = "\r\n";
html += "
\r\n";
html += "
X
\r\n";
html += "
\r\n";
html += "
\r\n";
html += "Что Вы хотите отредактировать?
\r\n";
html += options;
html += "
\r\n";
html += "
\r\n";
obj.innerHTML = html;
obj.style.display = '';
placeCentered();
window.onscroll = placeCentered;
window.onresize = placeCentered;
}
function setBack() {
setCookie("back_after_save", request_uri);
}
function setCookie(name, value) {document.cookie=name+"="+escape(value)+"; path=/";}
function getCookie(szName)
{
szName = szName.replace(/\./g, "_");
var i = 0;
var nStartPosition = 0;
var nEndPosition = 0;
var szCookieString = document.cookie;
while(i <= szCookieString.length)
{
nStartPosition = i;
nEndPosition = nStartPosition + szName.length;
if(szCookieString.substring(
nStartPosition,nEndPosition) == szName)
{
nStartPosition = nEndPosition + 1;
nEndPosition =
document.cookie.indexOf(";",nStartPosition);
if(nEndPosition < nStartPosition)
nEndPosition = document.cookie.length;
return document.cookie.substring(
nStartPosition,nEndPosition);
break;
}
i++;
}
return "";
}
function placeCentered() {
obj = document.getElementById('quickEdit');
leftLayer = (document.body.clientWidth - obj.offsetWidth)/2;
topLayer = (document.body.clientHeight - obj.offsetHeight)/2;
obj.style.left = leftLayer;
obj.style.top = topLayer + document.body.scrollTop;
}
function quickHide() {
obj = document.getElementById('quickEdit');
obj.style.display = 'none';
window.onscroll = "";
window.onresize = "";
}
function forum_check_reg_form() {
forum_login = document.getElementById('forum_login');
forum_password = document.getElementById('forum_password');
forum_password_check = document.getElementById('forum_password_check');
forum_email = document.getElementById('forum_email');
if(!forum_login || !forum_password || !forum_password_check || !forum_email) {
alert("Неправильно сформирована форма.");
return false;
}
if(forum_login.value == "") {
alert("Необходимо заполнить поле \"Логин\"");
return false;
}
if(forum_password.value == "") {
alert("Необходимо заполнить поле \"Пароль\"");
return false;
}
if(forum_password.value != forum_password_check.value) {
alert("Пароли не совпадают.");
return false;
}
if(forum_email.value == "") {
alert("Необходимо заполнить поле \"E-mail\"");
return false;
}
return true;
}
function subscribe_check_reg_form() {
subscribe_login = document.getElementById('subscribe_login');
subscribe_password = document.getElementById('subscribe_password');
subscribe_password_check = document.getElementById('subscribe_password_check');
subscribe_email = document.getElementById('subscribe_email');
if(!subscribe_login || !subscribe_password || !subscribe_password_check || !subscribe_email) {
alert("Неправильно сформирована форма.");
return false;
}
if(subscribe_login.value == "") {
alert("Необходимо заполнить поле \"Логин\"");
return false;
}
if(subscribe_password.value == "") {
alert("Необходимо заполнить поле \"Пароль\"");
return false;
}
if(subscribe_password.value != subscribe_password_check.value) {
alert("Пароли не совпадают.");
return false;
}
if(subscribe_email.value == "") {
alert("Необходимо заполнить поле \"E-mail\"");
return false;
}
return true;
}
function forum_check_form(obj) {
if(!obj)
return false;
if(obj.captcha) {
if(md5(obj.captcha.value) != getCookie("captcha1")) {
alert("Неправильный код.");
return false;
}
}
if(obj.login)
vlogin = obj.login.value;
else
vlogin = "";
if(obj.title)
vtitle = obj.title.value;
else
vtitle = "";
if(obj.body)
vbody = obj.body.value;
else
vbody = "";
if(vlogin.length == 0) {
alert("Введите имя.");
return false;
}
if(vtitle.length == 0) {
alert("Введите заголовок.");
return false;
}
bd = vbody.replace(/[ \t\r\n]*/g, "");
if(bd.length == 0) {
alert("Введите текст сообщения");
return false;
}
return true;
}
function forum_quote(mess_id) {
mess_obj = document.getElementById('mess_' + mess_id);
if(!mess_obj)
return false;
body_obj = document.getElementById('forum_body');
if(!body_obj)
return false;
if(is_ie) {
sel = getCurrSelection();
range = sel.createRange();
sel_str = range.text;
} else {
sel = getCurrSelection();
range = getRange(sel);
sel_str = range;
}
if(!is_ie)
qmess = mess_obj.textContent;
else
qmess = mess_obj.outerText;
if(sel_str && typeof sel_str != "undefined" && qmess) {
parentObj = range.commonAncestorContainer;
if(is_ie) {
if(qmess.replace(sel_str, "") != qmess) {
qmess = sel_str;
}
} else {
parentObj = range.commonAncestorContainer;
if(hasParent(parentObj, 'mess_' + mess_id)) {
qmess = range;
}
}
}
res = "";
real_id = mess_obj.id.substr(5, mess_obj.id.length - 5);
author_obj = document.getElementById('author_' + real_id);
if(author_obj) {
author = is_ie ? author_obj.innerText : author_obj.textContent;
author = "[b]" + trim(author) + "[/b]\r\n";
} else {
author = "";
}
if(qmess) {
if(body_obj.value.length == 0)
body_obj.value += "[QUOTE]" + author + qmess + "[/QUOTE]\r\n";
else
body_obj.value += "\r\n[QUOTE]" + author + qmess + "[/QUOTE]\r\n";
}
document.getElementById('forum_body').focus();
return false;
}
function getCurrSelection() {
if(document.selection)
return document.selection;
else
return window.getSelection();
}
function getRange(sel) {
if(!sel)
sel = getSelection();
if(typeof sel != "undefined") {
return sel.getRangeAt(0);
} else {
return window.document.createRange();
}
}
function hasParent(obj, par_id) {
if(!obj) {
return false;
}
if(obj.id == par_id) {
// alert(obj.id);
return true;
} else {
if(obj.parentNode) {
return hasParent(obj.parentNode, par_id);
} else {
return false;
}
}
}
function forum_toAuthor(obj) {
if(is_ie)
res = obj.innerText;
else
res = obj.textContent;
res = trim(res);
res = "[b]" + res + "[/b]\r\n";
document.getElementById('forum_body').value += res;
window.location = "#add";
document.getElementById('forum_body').focus();
return false;
}
function trim(str) {
// res = str.match(/[ ]*([A-z0-9А-я\-_ ]+)[ ]+/)[1];
// if(!res || res == "")
res = str.match(/[ ]*([A-z0-9А-я\-_\(\) ]+)[ ]+/)[1];
return res;
}
function qpanel_init() {
if("undefined" == typeof quickIsAuth) {
setTimeout(qpanel_init, 100);
return 1;
}
if(quickIsAuth != true) {
return 1;
}
obj = document.getElementById('qpanel_placer');
qpanel_reset(obj);
if(getCookie("pand_expanded") == 1) {
qpanel_renderSmall(obj);
qpanel_reset(obj);
qpanel_renderBig(obj);
} else {
qpanel_renderSmall(obj);
}
}
function qpanel_reset(obj) {
if(!qpanel_allowed)
return true;
obj.innerHTML = "";
obj.style.backgroundColor = "";
obj.style.width = "auto";
obj.style.height = "auto";
obj.style.cursor = "default";
obj.style.left = "auto";
obj.style.right = "auto";
obj.onclick = function () {};
}
function qpanel_renderSmall(obj) {
if(!qpanel_allowed)
return true;
setCookie("pand_expanded", 0);
obj.style.width = "181px";
obj.style.height = "19px";
obj.style.backgroundColor = "#ADADAD";
obj.style.position = "absolute";
obj.style.right = 0;
obj.style.top = 0;
html = "";
html = "
";
obj.innerHTML = html;
hobj = document.getElementById('qpanel_holder');
html = " Развернуть панель";
hobj.innerHTML = html;
obj.style.cursor = "pointer";
var gobj = obj;
obj.onclick = function () {
qpanel_reset(gobj);
qpanel_renderBig(gobj);
}
}
function qpanel_renderBig(obj) {
if(!qpanel_allowed)
return true;
setCookie("pand_expanded", 1);
obj.style.height = "34px";
obj.style.width = "100%";
obj.style.left = "0";
obj.style.right = "0";
obj.style.backgroundColor = "#F0F2F4";
var content = "";
content += "";
content += "";
content += " ";
if(quickUserInfo) {
user_info = "" + quickUserInfo[2] + " (" + quickUserInfo[1] + ")";
// user_info += " [ Настройки | ";
user_info += " [ Выход ]";
} else {
user_info = "";
}
content += user_info;
content += " | ";
content += "";
content += " ";
content += " | ";
options = "";
options = "\r\n";
for(i = 0; i < quickUrls.length; i++) {
qName = quickUrls[i][0];
qUrl = quickUrls[i][1];
if(qName && qUrl)
options += "\r\n";
}
content += "";
// content += " | ";
content += "";
content += " ";
content += " | ";
options = "";
options = "\r\n";
for(i = 0; i < quickMods.length; i++) {
qName = quickMods[i][1];
qUrl = "/admin/" + quickMods[i][0];
if(qName && qUrl)
options += "\r\n";
}
content += "";
// content += "";
content += "";
content += options;
content += " ";
content += " | ";
content += "";
content += " ";
content += " | ";
content += "";
content += " ";
content += "Администрирование";
content += " | ";
content += "";
content += " ";
content += " | ";
content += "";
content += " ";
content += "Скрыть";
content += " | ";
content += "";
content += "";
content += "";
content += "";
content += "";
content += "";
content += "";
content += "";
content += "";
content += "";
content += "";
content += "
";
html = "";
obj.innerHTML = html;
qo = document.getElementById('qpanel_desp');
var gobj = obj;
qo.onclick = function () {
qpanel_reset(gobj);
qpanel_renderSmall(gobj);
}
}
setTimeout(qpanel_init, 100);
function md5(s){
function Z(n,c){return(n<>>(32-c))}
function Y(q,a,b,x,s,t){return X(Z(X(X(a,q),X(x,t)),s),b)}
function A(a,b,c,d,x,s,t){return Y((b&c)|((~b)&d),a,b,x,s,t)}
function B(a,b,c,d,x,s,t){return Y((b&d)|(c&(~d)),a,b,x,s,t)}
function C(a,b,c,d,x,s,t){return Y(b^c^d,a,b,x,s,t)}
function D(a,b,c,d,x,s,t){return Y(c^(b|(~d)),a,b,x,s,t)}
function X(x,y){var l=(x&0xFFFF)+(y&0xFFFF),m=(x>>16)+(y>>16)+(l>>16);return(m<<16)|(l&0xFFFF)}
var w=s.length*8,i,hx="0123456789abcdef",L=(((w+64)>>>9)<<4)+15,x=Array(L+15);
for(i=0;i>5]|=(s.charCodeAt(i/8)&255)<<(i%32);
x[w>>5]|=0x80<<((w)%32);
x[L-1]=w;
var a=1732584193,b=-271733879,c=-1732584194,d=271733878;
for(i=0;i>2]>>((i%4)*8+4))&0xF)+hx.charAt((b[i>>2]>>((i%4)*8))&0xF);
return s
}
function users_check_reg_form() {
users_login = document.getElementById('users_login');
users_password = document.getElementById('users_password');
users_password_check = document.getElementById('users_password_check');
users_email = document.getElementById('users_email');
if(!users_login || !users_password || !users_password_check || !users_email) {
alert("Неправильно сформирована форма.");
return false;
}
if(users_login.value == "") {
alert("Необходимо заполнить поле \"Логин\"");
users_login.focus();
return false;
}
if(users_password.value == "") {
alert("Необходимо заполнить поле \"Пароль\"");
users_password.focus();
return false;
}
if(users_password.value != users_password_check.value) {
alert("Пароли не совпадают.");
users_password_check.focus();
return false;
}
if(users_email.value == "") {
alert("Необходимо заполнить поле \"E-mail\"");
users_email.focus();
return false;
}
return true;
}
function eshop_subscribe_check() {
fname = document.getElementById('fname');
lname = document.getElementById('lname');
mname = document.getElementById('mname');
email = document.getElementById('email');
if(fname.value == "") {
alert("Необходимо заполнить поле \"Имя\"");
fname.focus();
return false;
}
if(lname.value == "") {
alert("Необходимо заполнить поле \"Фамилия\"");
lname.focus();
return false;
}
if(mname.value == "") {
alert("Необходимо заполнить поле \"Отчество\"");
mname.focus();
return false;
}
if(email.value == "") {
alert("Необходимо заполнить поле \"E-mail\"");
email.focus();
return false;
}
return true;
}