function checkmailnews() {
if (!(/^[a-zA-Z][a-z0-9\-\_\.]{1,20}@[a-z0-9\-\_\.]{5,30}$/.test(document.getElementById("sendasknews").value))) {
alert("Проверьте E-mail адрес!");
return false;
}
return true;
}
function chk()
{
if (document.getElementById("keyword").value == "") {
alert('Введите ключевое слово или фразу!');
return false;
}
if (document.getElementById("keyword").value.length<=3) {
alert('Введите более 3 символов!');
return false;
}
document.getElementById('searchForm').submit();
}
function addpmenu(id)
{
window.open("tools_admin/editmenu.php?action=addme&idpm="+id,'myWin', 'width=450,height=158,status=no,toolbar=no,menubar=no,scrollbars=no');
}
function addanswer(id)
{
window.open("tools_admin/admguest.php?action=addoneanswer&idquest="+id,'addanswer', 'width=450,height=325,status=no,toolbar=no,menubar=no,scrollbars=no');
}
function editanswer(id)
{
window.open("tools_admin/admguest.php?action=editoneanswer&idquest="+id,'editanswer', 'width=450,height=325,status=no,toolbar=no,menubar=no,scrollbars=no');
}
function editmenu(id)
{
window.open("tools_admin/editmenu.php?action=editmenu&idmenu="+id,'myWin', 'width=450,height=153,status=no,toolbar=no,menubar=no,scrollbars=no');
}
function file(id)
{
window.open("uploadfilefor"+id+".html",'myFilePlus', 'width=450,height=140,status=no,toolbar=no,menubar=no,scrollbars=no');
}
function addcat(id)
{
window.open("tools_admin/editcat.php?action=addcat&idcat="+id,'myWin', 'width=450,height=150,status=no,toolbar=no,menubar=no,scrollbars=no');
}
function editcat(id)
{
window.open("tools_admin/editcat.php?action=editcat&idcat="+id,'myWin', 'width=450,height=144,status=no,toolbar=no,menubar=no,scrollbars=no');
}
function addgoods(id)
{
window.open("tools_admin/editgoods.php?action=addgoods&idcat="+id,'addgoods', 'width=450,height=235,status=no,toolbar=no,menubar=no,scrollbars=no');
}
function info(id)
{
window.open("infogoods.php?idgoods="+id,'infogoods', 'width=500,height=550,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes');
}
function big(id) {
window.open("building.php?id="+id,'building'+id, 'width=750,height=520,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');
}
function getAbsolutePos(el) {
var r = { x: el.offsetLeft, y: el.offsetTop };
if (el.offsetParent) {
var tmp = getAbsolutePos(el.offsetParent);
r.x += tmp.x;
r.y += tmp.y;
}
return r;
};
function __dlg_init(bottom) {
var body = document.body;
var body_height = 0;
if (typeof bottom == "undefined") {
var div = document.createElement("div");
body.appendChild(div);
var pos = getAbsolutePos(div);
body_height = pos.y;
} else {
var pos = getAbsolutePos(bottom);
body_height = pos.y + bottom.offsetHeight;
}
if (!document.all) {
var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
window.moveTo(x, y);
window.innerWidth = body.offsetWidth + 5;
window.innerHeight = body_height + 2;
} else {
var ch = body.clientHeight;
var cw = body.clientWidth;
var W = body.offsetWidth;
var H = 2 * body_height - ch;
var x = (screen.availWidth - W) / 2;
var y = (screen.availHeight - H) / 2;
window.moveTo(x, y);
}
};
function testregdata(frm)
{
if (frm.reg_name.value!='' && frm.reg_login.value!='' && frm.reg_email.value!='' && frm.reg_lastname.value!='' && frm.reg_pwd.value!='' && frm.reg_cppwd.value!='')
{
if(frm.reg_pwd.value==frm.reg_cppwd.value){
frm.submit();
}
else{
alert("Проверьте правильность ввода пароля!");
}
}else
{
alert("Заполните все обязательные поля!");
}
};
function testeditdata(frm)
{
if (frm.reg_name.value!='' && frm.reg_login.value!='' && frm.reg_email.value!='' && frm.reg_lastname.value!='')
{
frm.submit();
}
else
{
alert("Заполните все обязательные поля!");
}
};
function checkmessage(frm)
{
if (frm.title.value!='' && frm.message.value!='')
{
frm.submit();
}
else
{
alert("Заполните все поля!");
}
};
function answer(frm)
{
answer0 = 'document.getElementById("an'+frm+'").style.display';
answer1 = eval(answer0);
if(answer1=="none"){
ans = 'document.getElementById("an'+frm+'").style.display=""';
eval(ans);
}
else
{
ans = 'document.getElementById("an'+frm+'").style.display="none"';
eval(ans);
}
};
function checkfileupload()
{
name = document.getElementById('name').value;
file = document.getElementById('file').value;
if(file=='')
{
alert('Пожалуйста, выберете файл для загрузки');
return false;
}
}
function statusbar(val)
{
var msg = " ";
var res = " ";
var speed = 100;
var pos = val;
if (pos > 0) {
for (var position=0 ; position< pos; position++) {
res += " ";
}
res+=msg;
pos--;
window.status = res;
timer = window.setTimeout("statusbar("+pos+")",speed);
}
else{
if( -pos < msg.length) {
res += msg.substring(-pos,msg.length);
pos--;
window.status=res;
timer = window.setTimeout("statusbar("+pos+")",speed);
}
else
{
window.status= " ";
timer = window.setTimeout("statusbar(100)",speed);
}
}
}
statusbar(100);
function hideShopBasketDelButton(id)
{
elem = document.getElementById("shopBasketTableElemImg_" + id);
if ((elem != undefined) && (elem != null))
{
elem.style.display = "none";
}
}
function showShopBasketDelButton(id)
{
elem = document.getElementById("shopBasketTableElemImg_" + id);
if ((elem != undefined) && (elem != null))
{
elem.style.display = "block";
}
}
function ChooseSMSLen() {
if ($('usrMessage').value.length > 140) {
$('wordCounter').innerHTML = "" + $('usrMessage').value.length + "";
} else {
$('wordCounter').innerHTML = "" + $('usrMessage').value.length + "";
}
}
function sendAjaxRequest(link) {
new Ajax.Request(link, {
asynchronous:true,
evalScripts:true});
return false;
}
function get_flash(id,path,width,height,codebase_version,classid)
{
var tag = document.getElementById(id);
var code = '';
code = '';
tag.innerHTML = code;
}