﻿// Функция обработки e-mail адресов
function antispam(domen_zone,domen_name,body,text)
    {
    if (text == "#mail#") text = body+"@"+domen_name+"."+domen_zone;
    window.document.write("<a href='mailto:" + body+"@"+domen_name+"."+domen_zone+"'>"+text+"</a>");
    }
  
// Меняем кнопки при наведении и текстовые поля-при клике    
$(document).ready(function(){
    $("input.grey_textfield").bind("focus", function(e){
		$(this).css('border', '1px solid #e60004');
		$(this).css('background', '#fdf7f7');
    });
    
    $("textarea.grey_textfield").bind("focus", function(e){
		$(this).css('border', '1px solid #e60004');
		$(this).css('background', '#fdf7f7');
    });
    
    $("input.grey_textfield").bind("blur", function(e){
		$(this).css('border', '1px solid #646464');
		$(this).css('background', '#ffffff');
    });
    
    $("textarea.grey_textfield").bind("blur", function(e){
		$(this).css('border', '1px solid #646464');
		$(this).css('background', '#ffffff');
    });
    
    $("input.red_button").bind("mouseover", function(e){
        $(this).removeClass('red_button');
        $(this).addClass('red_button_hover');
    });
    
    $("input.red_button").bind("mouseout", function(e){
	    $(this).removeClass('red_button_hover');
        $(this).addClass('red_button');        
    });   
    
    
    $("td.dlMainMenu_td_no_selected").bind("mouseover", function(e){
        $(this).css('background', '#b5b5b5');
        $(this).find("a").css("color","#FFFFFF");
        $(this).find("a").css("text-decoration","underline")
    });
    
    $("td.dlMainMenu_td_no_selected").bind("mouseout", function(e){
	    $(this).css('background', '#dddddd url(img/pipe.gif) right no-repeat');
	    $(this).find("a").css("color","#646464");
        $(this).find("a").css("text-decoration","none")
    });  
}); 


// Объявим глобальные переменные
// Переменная состояния, по умолчанию ничего не двигается = false
var moveState = false;
// Переменные координат мыши в начале перемещения, пока неизвестны
var x0, y0;
// Начальные координаты элемента, пока неизвестны
var divX0, divY0;

// Выведем абсолютно-позиционированный DIV размером 50 * 50
// Зальем DIV черным цветом
// Добавим прямо в DIV обработчики событий
//document.write("<div style='position:absolute; top:0; left:0; background-color:black; width:50px; height:50px;' onmousedown = 'initMove(this, event);' onmouseup = 'moveState = false;' onmousemove = 'moveHandler(this, event);' id='test'>kjsdvnjskdncdsjknsdjk</div>");

// Объявим функцию для определения координат мыши
function defPosition(event) {
    var x = y = 0;
    if (document.attachEvent != null) { // Internet Explorer & Opera
        x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
        y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
    }
    if (!document.attachEvent && document.addEventListener) { // Gecko    
        x = event.clientX + window.scrollX;
        y = event.clientY + window.scrollY;
    }
    return {x:x, y:y};
}


// Функция инициализации движения
// Записываем всё параметры начального состояния
function initMove(div, event) {
    var event = event || window.event;
    x0 = defPosition(event).x;
    y0 = defPosition(event).y;    
    divX0 = parseInt(div.style.marginLeft);
    divY0 = parseInt(div.style.marginTop);
    moveState = true;
}

// Если клавишу мыши отпустили вне элемента движение должно прекратиться
document.onmouseup = function() {
    moveState = false;
    if (document.getElementById("icons_block").style.marginTop!="0pt" && document.getElementById("icons_block").style.marginLeft!="0px")
        {
        if (document.getElementById("icons_block").style.marginLeft.replace("px","")<80 && document.getElementById("icons_block").style.marginTop.replace("px","")<90)
            {
            document.getElementById("developers").style.display="block";
            //alert("LEFT:" + document.getElementById("icons_block").style.marginLeft +" TOP:" + document.getElementById("icons_block").style.marginTop);
            }
        }
   // document.getElementById("icons_block").style.left = 0;
   // document.getElementById("icons_block").style.top = 0;
   document.getElementById("icons_block").style.marginLeft = 697;
   document.getElementById("icons_block").style.marginTop = 11;
}

// И последнее
// Функция обработки движения:
function moveHandler(div, event) {
    var event = event || window.event;
    if (moveState) {
        div.style.marginLeft = divX0 + defPosition(event).x - x0;
        div.style.marginTop  = divY0 + defPosition(event).y - y0;
    }
}   

function hide_developers() {
document.getElementById("developers").style.display="none";
}

