var elm1="linz";
var elm2="";

function base64_encode(a) {
    var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
    var i, n = a.length, tmp = 0, s = Array();
    i = j = 0;
    while (i < n) {
        tmp = (tmp << 8) | a[i];
        if (i % 3 == 2) {
            s[s.length] = chars[(tmp >> 18) & 0x3f];
            s[s.length] = chars[(tmp >> 12) & 0x3f];
            s[s.length] = chars[(tmp >> 6) & 0x3f];
            s[s.length] = chars[tmp & 0x3f];
            j += 4;
            if (j % 76 == 0) s[s.length] = '\r\n';
            tmp = 0;
        }
        i++;
    }
    switch (i % 3) {
    case 1 :
        s[s.length] = chars[(tmp >> 2) & 0x3f];
        s[s.length] = chars[(tmp << 4) & 0x3f];
        s[s.length] = '=';
        s[s.length] = '=';
        break;
    case 2 :
        s[s.length] = chars[(tmp >> 10) & 0x3f];
        s[s.length] = chars[(tmp >> 4) & 0x3f];
        s[s.length] = chars[(tmp << 2) & 0x3f];
        s[s.length] = '=';
        break;
    }
    return s.join('');
}

function base64_decode(s) {
    s = s.split('');
    var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
    var i, j, codes = Object(), a = Array(), n = s.length, tmp = 0;
    for (i = 0; i < 64; i++) codes[chars[i]] = i; // формируем таблицу кодов
    i = j = 0;
    while (i < n) {
        while (i < n && isNaN(codes[s[i]]) && s[i] != '=') i++; // пропускаем неверные символы
        if (i == n || s[i] == '=') break;
        tmp = (tmp << 6) | codes[s[i]];
        if (j % 4 == 3) {
            a[a.length] = (tmp >> 16) & 0xff;
            a[a.length] = (tmp >> 8) & 0xff;
            a[a.length] = tmp & 0xff;
            tmp = 0;
        }
        j++;
        i++;
    }
    switch (j % 4) {
    case 2 :
        a[a.length] = (tmp >> 4) & 0xff;
        break;
    case 3 :
        a[a.length] = (tmp >> 10) & 0xff;
        a[a.length] = (tmp >> 2) & 0xff;
        break;
    }
    return a;
}

function utf8_encode(s) {
    var n = s.length, i, a = Array(), ch;
    for (i = 0; i < n; i++) {
        ch = s.charCodeAt(i);
        if (!(ch >> 7)) a[a.length] = ch; // один байт
        else if (!(ch >> 11)) {
            // два байта
            a[a.length] = 0xc0 | (ch >> 6);
            a[a.length] = 0x80 | (ch & 0x3f);
        } else if (!(ch >> 16)) {
            // три байта
            a[a.length] = 0xe0 | (ch >> 12);
            a[a.length] = 0x80 | ((ch >> 6) & 0x3f);
            a[a.length] = 0x80 | (ch & 0x3f);
        } else {
            // четыре байта
            a[a.length] = 0xf0 | (ch >> 18);
            a[a.length] = 0x80 | ((ch >> 12) & 0x3f);
            a[a.length] = 0x80 | ((ch >> 6) & 0x3f);
            a[a.length] = 0x80 | (ch & 0x3f);
        }
    }
    return a;
}

function utf8_decode(a) {
    var n = a.length, i, s = '', ch;
    i = 0;
    while (i < n) {
        if (!(a[i] & 0x80)) ch = a[i]; // один байт
        else if (i + 1 < n && !((a[i + 1] & 0xc0) ^ 0x80)) {
            if (!((a[i] & 0xe0) ^ 0xc0)) {
                ch = ((a[i] & 0x1f) << 6) | (a[i + 1] & 0x3f); // два байта
                i++;
            }
            else if (i + 2 < n && !((a[i + 2] & 0xc0) ^ 0x80)) {
                if (!((a[i] & 0xf0) ^ 0xe0)) {
                    ch = ((a[i] & 0x0f) << 12) | ((a[i + 1] & 0x3f) << 6) | (a[i + 2] & 0x3f); // три байта
                    i += 2;
                }
                else if (i + 3 < n && !((a[i + 3] & 0xc0) ^ 0x80)) {
                    if (!((a[i] & 0xf8) ^ 0xf0)) {
                        ch = ((a[i] & 0x07) << 18) | ((a[i + 1] & 0x3f) << 12) | ((a[i + 2] & 0x3f) << 6) | (a[i + 3] & 0x3f); // четыре байта
                        i += 3;
                    }
                    else {
                        // неверный формат символа с индексом i
                    }
                } else {
                    // неверный формат символа с индексом i + 3
                }
            } else {
                // неверный формат символа с индексом i + 2
            }
        } else {
            // неверный формат символа с индексом i + 1
        }
        s += String.fromCharCode(ch);
        i++;
    }
    return s;
}

/********************************************************************************/

function b64dec(str)
{
	return utf8_decode(base64_decode(str));
}

function b64enc(str)
{
	return base64_encode(utf8_encode(str));
}

var elm1="linz";
var elm2="";

function createPictureWindow(Path,Width,Height,Title)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<head><title>'+Title+'</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	w.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><img src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='&quot;"+Title+"&quot;'></body>"); 
	w.document.close();
}

function createDynamicWindow(Path,Width,Height,Title)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<head><title>'+Title+'</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	w.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><img src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='&quot;"+Title+"&quot;'></body>"); 
	w.document.close();
}

function createDescriptionWindow(_file,_width,_height)
{
	wTop = (screen.height-_height)/3;
	wLeft = (screen.width-_width)/2;
	WinFeatures = "top="+wTop+",left="+wLeft+",width="+_width+",height="+_height+",maximize=no,minimize=no,Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes,resize=no";
	_newDescription = window.open(_file,"frontendDescriptionWindow",WinFeatures);
}

function message(form) {
	formElement = document.forms[form].elements;
	isFilled = true;
	for(j=0; j<formElement.length; j++) if(formElement[j].value == '') isFilled = false;
	if (!isFilled)  {
		alert('Все поля формы должны быть заполнены!'); return false;
	}
	else return true;
}

function checkFields(form) {
	f1 = document.forms[form].user_login.value;
	f2 = document.forms[form].user_password.value;
	f3 = document.forms[form].user_email.value;
	
	if (f1 == "") {
		alert("Введите, пожалуйста, Ваш логин");
		return false;
	}
 	else if (f2 == "") {
		alert("Введите, пожалуйста, Ваш пароль");
		return false;
	}
	else if ((f3 == "") || (f3.indexOf('@')<0) || (f3.indexOf('.')<0)) {
		alert("Введите, пожалуйста, корректный e-mail");
		return false;
	}
	else return true;
}

function formValid(form) {
	f1 = document.forms[form].author.value;
	f2 = document.forms[form].title.value;
	f3 = document.forms[form].email.value;
	
	if (f1 == "") {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
 	else if (f2 == "") {
		alert("Введите, пожалуйста, Ваше сообщение");
		return false;
	}
	else if ((f3 == "") || (f3.indexOf('@')<0) || (f3.indexOf('.')<0)) {
		alert("Введите, пожалуйста, корректный e-mail");
		return false;
	}
	else return true;
}


function AddBookMark() {  if (document.all) {    window.external.AddFavorite("<?=$xpath?>","<?=htmlspecialchars(str_replace("|","-",$SITE_GLOBAL_NAME))?>");  } else {    alert("Ваш браузер не поддерживает функцию добавления закладок.");  }}

function getMovie() {
        var M$ =  navigator.appName.indexOf("Microsoft")!=-1
        return (M$ ? window : document)["sdkl"]
    }
    function Init(pr){     
        try{
            if (elm1!=""){
                var objd = b64dec("ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZWxtMSkuc3R5bGUuZGlzcGxheSA9ICJub25lIjs=");
                eval(objd);
            }
            if (elm2!=""){
                var objd = b64dec("ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZWxtMikuc3R5bGUuZGlzcGxheSA9ICJub25lIjs=");
                eval(objd);
            }
        } catch (eee){
            var err=0;
        }
        if (pr==null){
            ck="audio_song";
        } else {
            ck = pr;
        }
        var obj = getMovie();
        if (checkCookies(ck)){
             var prm = 1;
             obj.SetVariable("mymessage",prm);
             if (pr==null){
                obj.SetVariable("mysound","audio_song");
             } else {
                obj.SetVariable("mysound",pr);
             }
        } else {
             var prm = 2;
             obj.SetVariable("mymessage",prm);
             if (pr==null){
                obj.SetVariable("mysound","audio_song");
             } else {
                obj.SetVariable("mysound",pr);
             }
        }
    }
    
    function InitNoFlash(){
        try{
        if (elm1!=""){
            var objd = b64dec("ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZWxtMSkuc3R5bGUuZGlzcGxheSA9ICJub25lIjs=");
            eval(objd);
        }
        if (elm2!=""){
            var objd = b64dec("ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZWxtMikuc3R5bGUuZGlzcGxheSA9ICJub25lIjs=");
            eval(objd);
        }
        } catch (ee){
            var err=0;
        }
    }
    function checkCookies(cc){
        var cook = getCookie("sdkl_sound_"+cc);
        if ((cook==null) || (cook==1)){return true;} else {return false;}
    }
    function SetCookies(ck){
        var now = new Date();
        fixDate(now);
        now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
        setCookie("sdkl_sound_"+ck, 1, now);
    }
    function ClearCookies(ck){
        var now = new Date();
        fixDate(now);
        now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
        setCookie("sdkl_sound_"+ck, 0, now);
    }

    function setCookie(name, value, expires, path, domain, secure) {
      var curCookie = name + "=" + escape(value) +
         ((expires) ? "; expires=" + expires.toGMTString() : "") +
         ((path) ? "; path=" + path : "") +
         ((domain) ? "; domain=" + domain : "") +
         ((secure) ? "; secure" : "")
         document.cookie = curCookie;
   }
   function getCookie(name) {
      var prefix = name + "="
      var cookieStartIndex = document.cookie.indexOf(prefix)
      if (cookieStartIndex == -1)
         return null
      var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex +
         prefix.length)
      if (cookieEndIndex == -1)
         cookieEndIndex = document.cookie.length
      return unescape(document.cookie.substring(cookieStartIndex +
         prefix.length,
   cookieEndIndex))
   }
   function deleteCookie(name, path, domain) {
      if (getCookie(name)) {
         document.cookie = name + "=" +
         ((path) ? "; path=" + path : "") +
         ((domain) ? "; domain=" + domain : "") +
         "; expires=Thu, 01-Jan-70 00:00:01 GMT"
      }
   }
   function fixDate(date) {
      var base = new Date(0)
      var skew = base.getTime()
      if (skew > 0)
         date.setTime(date.getTime() - skew)
   }
   
   function hide(){
    if (elm1!=""){
            var objd = b64dec("ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZWxtMSkuc3R5bGUuZGlzcGxheSA9ICJub25lIjs=");
            eval(objd);
   }
   }