﻿var baseDomain = "http://"+window.location.hostname;
var returnUrl = "";
function wopen(url, name, w, h){w += 32;h += 96;wleft = (screen.width - w) / 2;wtop = (screen.height - h) / 2;var win = window.open(url, name, 'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no');win.resizeTo(w, h); win.moveTo(wleft, wtop);win.focus();}
function wopensc(url, name, w, h){w += 32;h += 96;wleft = (screen.width - w) / 2;wtop = (screen.height - h) / 2;var win = window.open(url, name, 'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=no');win.resizeTo(w, h); win.moveTo(wleft, wtop);win.focus();}
function redirect(url) { var version = parseInt(navigator.appVersion); if (version>=4 || window.location.replace) { window.location.replace(url); } else { window.location.href = url; }}
function n(url) { window.location = url; }
function sS(e) {var keycode;var keychar;var numcheck;if(window.event) {keycode = e.keyCode;}else if(e.which) {keycode = e.which;} else { return true; }if (keycode == 13){doSearch();return false;}else return true;}
function sLogin(e) {var keycode;var keychar;var numcheck;if(window.event) {keycode = e.keyCode;}else if(e.which) {keycode = e.which;} else { return true; }if (keycode == 13){doLogin();return false;}else return true;}
function doSearch() { var txtSearch = document.getElementById("q"); if (txtSearch.value.length >= 3) {changeObjectVisibility('dSearch','hidden'); changeObjectVisibility('dSProgress','visible'); window.location.href = "/search/?q=" + encodeURIComponent(txtSearch.value); }}
function doSignup() { txtPasswordwindow.location.href = "/signup/?a=" + encodeURIComponent(txtEmail.value);}
function getValue(obj) { if (obj != null) { return obj.options[obj.selectedIndex].value;}}
function redirect(url) { var version = parseInt(navigator.appVersion); if (version>=4 || window.location.replace) { window.location.replace(url); } else { window.location.href = url; }}
function getStyleObject(objectId) { if(document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) {return document.all(objectId).style; } else if (document.layers && document.layers[objectId]) {return document.layers[objectId]; } else { return false; }}
function changeObjectVisibility(objectId, newVisibility) { var styleObject = getStyleObject(objectId); if(styleObject) { styleObject.visibility = newVisibility; if (newVisibility == "visible") { styleObject.display = 'block'; } else { styleObject.display = 'none'; }return true; } else { return false; }}
function doLogin() { var txtUser = document.getElementById("txtEmail").value;var txtPassword = document.getElementById("txtPass").value;if ((txtUser.length >= 2) && (txtPassword.length >= 2)) {changeObjectVisibility('lmsg', 'visible');changeObjectVisibility('ctl00_divLogin', 'hidden');var loader=new net.ContentLoader(uncache(baseDomain + '/authenticate/?u=' + encodeURIComponent(txtUser) + '&p=' + encodeURIComponent(txtPassword)), doAuth);}}
function doAuth(){changeObjectVisibility('lmsg', 'hidden');changeObjectVisibility('ctl00_divLogin', 'visible');var r = this.req.responseText;if (r != 'no_auth') { changeObjectVisibility('lmsg', 'visible');changeObjectVisibility('ctl00_divLogin', 'hidden');redirect(baseDomain + '/authenticate/?at=' + r + '&ru=' + returnUrl); } else { alert('Пароль или электронный адрес не действительны. Пожалуйста убедитесь, что все верно.');}}
function eventReady() {var r = this.req.responseText; }
function clock() {if (!document.layers && !document.all) {return;}
var runTime = new Date();var hours = runTime.getHours();var minutes = runTime.getMinutes();var seconds = runTime.getSeconds();
if (hours == 0) {hours = 12;}if (hours <= 9) {hours = "0" + hours;}if (minutes <= 9) {minutes = "0" + minutes;}
if (seconds <= 9) {seconds = "0" + seconds;}movingtime = hours + ":" + minutes + ":" + seconds;
if (document.layers) {document.layers.clocklayer.document.write(movingtime);document.layers.clocklayer.document.close();}
else if (document.all) {clocklayer.innerHTML = movingtime;}setTimeout("clock()", 1000)}
function addToFavorite( linkUrl, linkTitle ) {if ( !document.all ) alert( "Please press Ctrl-D to set it!" );else external.AddFavorite( linkUrl, linkTitle );}
function uncache(url){var d = new Date();var time = d.getTime();return url + '&uct='+time;}
function setStatus(str){window.status=str;return true;}
function Disable(obj) {try { obj.disabled = true; } catch (exception) { }}
function Enable(obj) {try { obj.disabled = false; } catch (exception) { }}
function sendPage(url) {wopen ('/sendpage?url=' + encodeURIComponent(window.location), 'Send_page', 430, 340);}
function HomePage() { if ( ! document.all ) { alert("This function doesn't work under Mozilla Browsers - Netscape or FireFox! \n\nPlease set it at:\n\tEdit/Preferences/Navigator \nmanualy!"); } else { newHomepage.style.behavior='url(#default#homepage)';newHomepage.setHomePage(baseDomain); } }
function textCounter(o, maxlimit) { var charsleft = (maxlimit - o.value.length); document.getElementById('charsleft').innerHTML = charsleft; if (charsleft <= 0) { o.value = o.value.substring(0, maxlimit); }}
function printPage() {window.print();}
function fpo(obj) { obj.className = "fpm_on"; }
function fpt(obj) { obj.className = "fpm"; }
function isEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
    if (strEmail.search(validRegExp) == -1) 
   {
      return false;
    } 
    return true; 
}
function doSend() { 

var message = $('#message').val();
if (message.length < 5) { alert("Пожалуйста заполните форму сообщения"); return false; }
var email = $('#replyto').val();
if (!isEmail(email)) {  alert("Пожалуйста впишите Ваш обратный адрес."); return false;$('#replyto').focus(); }

$.getIfModified("/ajaxserver/sendcontact.aspx", {r:encodeURIComponent(email), c:encodeURIComponent(message)}, function(data) {

if (data == "ok") { 

$('#email').BlindToggleVertically(450, function() { 
$('#thankyou').BlindToggleVertically(450, function() {  }, 'bounceout');
 }, 'bounceout');
  }
});

}

window.onload=function() {
try { 
var l1 = document.getElementById('l1');
l1.style.visibility = 'hidden';
} catch (e) { }
try {
var l2 = document.getElementById('l2');
l2.style.visibility = 'hidden';
} catch (e) { }
 }
