flag = 0;
document.onmousemove = function mousePageXY(e){
	if(flag == 0) {
  e = e||window.event;
  var x = 0;
  var y = 0;
  if (e.pageX || e.pageY)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else if (e.clientX || e.clientY)
  {
    x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  }
  Dwidth = document.body.clientWidth
  Dheight = document.body.scrollHeight
  formBlock = document.getElementById('alertBlock')   
  maxWidth = Dwidth-=570;
  maxHeight = Dheight-=285;
		if(maxWidth >= x) {
		formBlock.style.left = x+20+'px'
		}else{
		formBlock.style.left = x-440+'px'
		}
		if(maxHeight >= y) {
		formBlock.style.top = y+20+'px'
		}else{
		formBlock.style.top = y-270+'px'	
		}
	}
}

function blackFonc(e){
fonImg = document.getElementById('blackFon')
fonFrame = document.getElementById('blackFrame')
formBlock = document.getElementById('alertBlock')
Dwidth = document.body.clientWidth
Dheight = document.body.scrollHeight
fonImg.style.width = Dwidth+'px'
fonImg.style.height = Dheight+'px'
fonFrame.style.width = Dwidth+'px'
fonFrame.style.height = Dheight+'px'
fonImg.style.display = 'block'
formBlock.style.display = 'block'
fonFrame.style.display = 'block'
	flag = 1;
}

function closedFon(){
document.getElementById('blackFon').style.display = 'none'
document.getElementById('blackFrame').style.display = 'none'
document.getElementById('alertBlock').style.display = 'none'
	flag = 0;
}


// подсветка для рекламы

function bgSelecter(){
var d = document.getElementsByTagName('div')
	for(var i=0;i<d.length;i++) {
		if(d[i].className == 'pr_blockPadd2'){
			d[i].onmouseover = function(){
			this.style.background = '#efefe6'
			document.getElementById('prBlackFon').style.zIndex = '4';
			if(this.style.zIndex == 1) {
				document.getElementById('banner1').style.zIndex = '5';
			}
			if(this.style.zIndex == 2) {
				document.getElementById('banner2').style.zIndex = '5';
			}
			if(this.style.zIndex == 3) {
				document.getElementById('banner3').style.zIndex = '5';
			}
			}
			d[i].onmouseout = function(){
			this.style.background = '#fcfcf2'
			document.getElementById('prBlackFon').style.zIndex = '1';
			if(this.style.zIndex == 1) {
				document.getElementById('banner1').style.zIndex = '3';
			}
			if(this.style.zIndex == 2) {
				document.getElementById('banner2').style.zIndex = '3';
			}
			if(this.style.zIndex == 3) {
				document.getElementById('banner3').style.zIndex = '3';
			}
			}
		}
	}	
}


function errreport_sendmessage_request(txt, xml)
{
}

function errreport_sendmessage(country_id, city_id, type_id, object_id, pagetype,lang)
{
    var msg = ge("errreport_text").value;
    var sxml = '<errreport><lang>'+lang+'</lang><text>'+msg+'</text><pagetype>'+pagetype+'</pagetype><link>'+document.location+'</link><country>'+country_id+'</country><city>'+city_id+'</city><type>'+type_id+'</type><obj>'+object_id+'</obj></errreport>';
    AjaxXmlRequest(sxml,'mod/errreport/core.aspx?option=insert',errreport_sendmessage_request);
    closedFon();    
}



function getSelectionText() 
{
	var txt = '';
	if (txt = window.getSelection) txt = window.getSelection().toString();
	else txt = document.selection.createRange().text;
	return txt;
}



document.onkeypress = catchKey;
function catchKey (event) 
{
	if (window.event) event = window.event;
    if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) 
    {
	    var txt = getSelectionText();
		if (txt && txt.length)
		    ge("errreport_text").value = txt;

		blackFonc();
    }
}


        




