<!--
	function getDocumentHeight()
	{
		return (document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;
	}
	function resizeBox(opt){
		d = document;
		sAB = d.getElementById("ab").style;
		sLB = d.getElementById("lb").style;
		sMB = d.getElementById("mb").style;
		sCB = d.getElementById("cb").style;
		sRB = d.getElementById("rb").style;
		sLogo = d.getElementById("logo").style;
		sLogo.width = '';
		sLogo.height = '';
		var logoW = d.getElementById("logo").width;
		var logoH = d.getElementById("logo").height;

		dB = d.body.clientWidth;
		if(dB) {
		if(dB>1200) { 
			sLB.width = "272px"; sMB.width = dB -272-70 + "px";sRB.width = "205px"; sCB.width = dB -205-276-70 + "px"; sAB.marginLeft = "35px";sAB.marginRight = "35px";
			if(logoW > 260){
				sLogo.height = (logoH/logoW)*260;
				sLogo.width = 260;
		
			}
			else if(logoH > 110){
				sLogo.width = (logoW/logoH)*110;
				sLogo.height = 110;
			}

		}
		else if(d.body.clientWidth<1200) {
			sAB.marginLeft = "0px";sAB.marginRight = "0px";sLB.width = "195px"; sMB.width = d.body.clientWidth -195 + "px";sRB.width = "20%";sCB.width = "80%"; 
			sLogo.height = (logoH/logoW)*185;
			sLogo.width = 185;
		}
		else {sLB.width = "21%"; sMB.width = "79%";sRB.width = "20%";sCB.width = "80%"; sAB.marginLeft = "35px";sAB.marginRight = "35px";}
		}
		if(d.getElementById("d19")){
		if(dB<1120){d.getElementById("d19").style.width = "315px";d.getElementById("d20").style.width = "315px";} else {d.getElementById("d19").style.width = "330px";d.getElementById("d20").style.width = "330px";}
		}

	}
	
window.onresize= resizeBox;

function treatment_keys(event) 
{
	var AgntUsr=navigator.userAgent.toLowerCase();
	var Opr=AgntUsr.indexOf('opera')!=-1?1:0;
	var FFox=AgntUsr.indexOf('firefox')!=-1?1:0;
	var code = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

	if(FFox == 1&&(event.ctrlKey)&&code==120)
	{
		var text = document.getSelection();
		popupVisible();
		document.spelling.content.value = text;
		document.getElementById('word').innerHTML = text;
		code = 0;
		return false;
	}
	if( (Opr == 1&&(window.event.ctrlKey)&&code==88) || (Opr != 1&&FFox != 1&&(window.event.ctrlKey)&&code==24))
	{
		
		var text = document.selection.createRange().text;
		popupVisible();
		document.spelling.content.value = text;
		document.getElementById('word').innerHTML = text;
		code = 0;
		return false;
	}
}

function mousePosition(e)
{
 mouseX = (e.pageX) ? e.pageX : document.body.scrollLeft+event.clientX;
 mouseY = (e.pageX) ? e.pageY : document.body.scrollTop+event.clientY;
}

if (navigator.appName == "Microsoft Internet Explorer")
     document.attachEvent('onmousemove', mousePosition);
else document.addEventListener('mousemove', mousePosition, false);

function popupVisible()
{
  elem = document.getElementById('windowpopup');

  elem.style.position   = 'absolute';
  elem.style.visibility = 'visible';
  elem.style.display    = 'block';

  elem.style.left = (mouseX-150)+'px';
  elem.style.top  = (mouseY+10)+'px';
	
}

function popupExit()
{
  var elem = document.getElementById('windowpopup');
  elem.style.visibility = 'hidden';
  elem.style.display    = 'none';
}

function SendMail(num,name,ind)
{
	sep = '@';
	if(ind == 1) dom = 'deshevshe.net.ua'
	else if (ind == 2) dom = 'deshevshe.lviv.ua'
	else if (ind == 3) dom = 'ukr.net'
	document.getElementById('mail_'+num).href = 'mailto:'+name+sep+dom;
}

function mail_encoding(num,text)
{
	i = 0;
	res = '';
	while(text.length > i)
	{
		if(i%2 == 0)
		{
			res = res+text.charAt(i);
		}
		i++;
	}
	document.getElementById('mail_'+num).href = 'mailto:'+res;
}

// function m_(text)
// {
	// i = 0;
	// res = '';
	// while(text.length > i)
	// {
		// if(i%2 == 0)
		// {
			// res = res+text.charAt(i);
		// }
		// i++;
	// }
	// window.location = 'mailto:'+res;
	////document.getElementById('mail_'+num).href = 'mailto:'+res;
	
	////document.getElementById('mail_'+num).href = '';
	// return false;
// }
function arrUnique(inputArr) {
	var a = [];
	var l = inputArr.length;
	for(var i=0; i<l; i++) {
	  for(var j=i+1; j<l; j++) {
		// If inputArr[i] is found later in the array
		if (inputArr[i] === inputArr[j])
		  j = ++i;
	  }
	  a.push(inputArr[i]);
	}
	return a;
};

function mencoding(settings){
	settings = jQuery.extend({
		className: 'jMail',
		insertHTML: true
	},settings);
	
	var element = $('.'+settings.className);
	var tableDataStr='||';
	if(element){
		$.each(element, function(i, val){
			tableDataStr += $(val).attr('data-m')+'||';
		});
		$.getJSON("../lib/clientModules/moduleMail.php", {
				operation: "jMail",
				data: tableDataStr
			}, function(json){
				$.each(json, function(i, val){
					$('.'+settings.className+'[data-m="'+i+'"]').unbind().bind('click', function(){
						parent.location='mailto:'+val; return false;
					}).css({'cursor':'pointer'}).attr('title','email: '+val)
					if(settings.insertHTML==true)
					$('.'+settings.className+'[data-m="'+i+'"]').html(val);
				});
				console.log(json)
		});
	}
	;
}

function m_(settings){
	settings = jQuery.extend({
		className: 'jMail',
		insertHTML: true
	},settings);
	
	var element = $('.'+settings.className);
	var datadat='';
	var tableDataStr='&';

	if($(element).attr('data-dat') != '' && $(element).attr('data-dat') != undefined){
		datadat = $(element).attr('data-dat');
	}
	$.each(element, function(ind, val){
		tableDataStr += $(val).attr('data-id')+'&';
	});
	$.getJSON("../lib/clientModules/moduleMail.php", {
			a_action: "AJAX",
			act: "email",
			table: $(element).attr('data-table'),
			dataDat: datadat,
			tableData: tableDataStr 
		}, function(json){
			$.each(json, function(i, val){
				$('.'+settings.className+'[data-id="'+i+'"]').unbind().bind('click', function(){
					parent.location='mailto:'+val; return false;
				}).css({'cursor':'pointer'}).attr('title','email: '+val)
				if(settings.insertHTML==true)
				$('.'+settings.className+'[data-id="'+i+'"]').html(val);
			});
	});
}

function getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
};
/**
 / THIRD FUNCTION
 * getPageScroll() by quirksmode.com
 *
 * @return Array Return an array with x,y page scroll values.
 */

function getPageScroll() {
	var xScroll, yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}
	arrayPageScroll = new Array(xScroll,yScroll);
	return arrayPageScroll;
};

/**********
**********/

function treatTag(tagData){
	if($('[data-focus=focused]').attr('id')){
		var fieldData = $('[data-focus=focused]');
	}
	else{
		var fieldData = $('textarea:first');
	}
	var formData = $('[data-focus=focused]').parents('form:first');
	var activeField = $('#'+fieldData.attr('id'));
	var range = activeField.getSelection();
	var FLAG_adspace = false;
	var valueFull;
	
	if(tagData.match(/^<[a-zA-Z0-9\=\"\'\:\-; ]+><\/[a-zA-Z]+>$/g)){
		var matchTag = 'container';
	}
	else if(tagData.match(/^(<[a-zA-Z0-9\=\"\' ]+((\/>)|(>)))$/g)){
		var matchTag = 'single';
	}
	else if(tagData.match(/^&.+;$/g)){
		var matchTag = 'spchar';
	}
	else{
		var matchTag = 'other';
	}
	
	//if tag has attributes promt user to enter their values
	attributes = tagData.match(/(\s\w+\=\"\")/g);
	if(attributes){
		var atributesStr = new String();
		for (var n=0; n < attributes.length; n++) {
			var attrName = attributes[n].match(/\w+[^=]/g);
			var attrDefaultVal = '';
			if(attrName == 'src' || attrName == 'href')	attrDefaultVal = 'http://';
			
			var attrVal	= prompt('Çíà÷åíèå àòðèáóòà '+attrName+':', attrDefaultVal);
			if(attrVal != '' && attrVal != null)
				atributesStr = attrName+'="'+attrVal+'"';
			else
				atributesStr = '';
				
			tagData = tagData.replace(attrName+'=""', atributesStr)
		}
	}
	
		
	//trim selection and add flag on space add
	if(range.text.match(/^\s+|\s+$/g)){
		range.text = range.text.replace(/^\s+|\s+$/g, '');
		FLAG_adspace = true
	}
	
	//treat certain tag types
	if(matchTag == "container"){
		if(range.text == '' || range.text == null)
			var text=prompt('Ââåäèòå òåêñò:');
		else
			var text=range.text;
		// console.log(tagData);
		tagData.match(/^(<[^>]+>)(<\/[a-zA-Z0-9\=\"\' ]+>)$/g)
		valueFull = (RegExp.$1 + text + RegExp.$2);
	}
	else if(matchTag == "single" || matchTag == "spchar" || matchTag == "other"){
			valueFull = tagData;
	}
	
	//replace selection and move caret
	if(valueFull){
		if(FLAG_adspace) valueFull = valueFull+' ';
		activeField.replaceSelection(valueFull)
		setCaretToPos(document.getElementById(activeField.attr('id')), range.start + valueFull.length)
	}
	
}

function setSelectionRange(input, selectionStart, selectionEnd) {
  if (input.setSelectionRange) {
    input.focus();
    input.setSelectionRange(selectionStart, selectionEnd);
  }
  else if (input.createTextRange) {
    var range = input.createTextRange();
    range.collapse(true);
    range.moveEnd('character', selectionEnd);
    range.moveStart('character', selectionStart);
    range.select();
  }
}

function setCaretToPos(input, pos) {
  setSelectionRange(input, pos, pos);
}
-->
