function openEditor(url){
window.open(url,'wv',"width=770,height=580,copyhistory=no,status=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no,toolbar=no");}

function openPrint(url){
window.open(url,'pp',"width=770,height=580,copyhistory=no,status=no,directories=no,menubar=yes,location=no,resizable=yes,scrollbars=yes,toolbar=yes");}

function openKupon(url){
  var dh = getWinSize().height;
  var dw = getWinSize().width;
  var objtop = dh / 2 + document.documentElement.scrollTop - 270;
  var objleft = dw / 2  - 360;
window.open(url,'pp',"width=760,height=540,left="+objleft+",top="+objtop+",copyhistory=no,status=no,directories=no,menubar=yes,location=no,resizable=no,scrollbars=no,toolbar=no");}

function openMap(url){
	var dh = getWinSize().height;
	var dw = getWinSize().width;
	var objtop = dh / 2 + document.documentElement.scrollTop - 280;
	var objleft = dw / 2  - 360;
	window.open(url,'pp',"width=720,height=560,left="+objleft+",top="+objtop+",copyhistory=no,status=no,directories=no,menubar=yes,location=no,resizable=no,scrollbars=no,toolbar=no");
}

function openImage(url){
window.open(url,'pp',"width=650,height=650,copyhistory=no,status=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes,toolbar=no");}

function einfo(url){
window.open(url,'pp',"width=700,height=500,copyhistory=no,status=no,directories=no,menubar=yes,location=no,resizable=yes,scrollbars=yes,toolbar=yes");}

function openCalendar(url){
window.open(url,'wv',"width=250,height=220,copyhistory=no,status=yes,directories=no,menubar=no,location=no,resizable=no,scrollbars=no,toolbar=no");}


function openHelp(url){
window.open(url,'help',"width=770,height=580,copyhistory=no,status=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes,toolbar=no");}

 function news(url)
 {
  window.open(url,'nn',"width=420,height=380,copyhistory=no,status=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes,toolbar=no");
 }
 function uinfo(url)
 {
  window.open(url,'tt',"width=420,height=380,copyhistory=no,status=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes,toolbar=no");
 }
function openSelect(url){
window.open(url,'sel',"width=760,height=540,copyhistory=no,status=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes,toolbar=no");}

function detailes(url){
window.open(url,'dd',"width=760,height=540,copyhistory=no,status=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes,toolbar=no");}

//-----------------------------------------------------------------------------------------------------------------------------------------	
function getElementTopPos(inputObj)
{		
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null) {if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;}
  return returnValue;
}	
//-----------------------------------------------------------------------------------------------------------------------------------------
function getWinSize() {
        var myWidth = 0, myHeight = 0;
        if (typeof( window.innerWidth ) == 'number') {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
        } else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight )) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
        } else if (document.body && ( document.body.clientWidth || document.body.clientHeight )) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
        }
        return {'width':myWidth, 'height':myHeight};
    }

//-----------------------------------------------------------------------------------------------------------------------------------------
function viewCalendar(direction, dt, category){
	var uri = '/blogs/ajax/calendar/index.html?direction=' + direction + "&date=" + dt + "&return=html&rnd=" + new Date().getTime();
	if (category) uri += '&categoryID=' + category;
	new Ajax.Updater('blogCalendarID', uri, {method: 'get'});
}
function viewDiv(el, id){
	var div = $(id);
	if (div.style.display == 'block') {div.style.display = 'none'; el.className = "arrow-down";}
	else {div.style.display = 'block'; el.className = "arrow-down select";}
}
function showPlace(placeID)
{
 new Ajax.Updater('placeItem', '/ajax/get_place/index.html?placeID=' + placeID + '&return=html&rnd=' + new Date().getTime(), 
           {method: 'get', evalScripts: true});
}
function showAdmin(adminID)
{
	$('#order').innerHTML = '';
 	if (document.documentElement) {
		st = document.documentElement.scrollTop;
 	}
 	if (st == 0)
 	{
		if (document.body) {
			st = document.body.scrollTop;
		}
 	}

/* 	
 	new Ajax.Updater('adminItem', '/ajax/get_admin/index.html?adminID=' + adminID + '&return=html&rnd=' + new Date().getTime(), 
           {method: 'get', evalScripts: true});
*/           
	$.ajax({
			url: '/ajax/get_admin/index.html?adminID=' + adminID + '&return=html&rnd=' + new Date().getTime(),             // указываем URL и
			dataType : "html",                     // тип загружаемых данных
			success: function (data, textStatus) { // вешаем свой обработчик на функцию success
				if(data != 'Error') {
					$('#order')[0].innerHTML = data;
				}
			}
			});
//	var objh = $('#adminItem')[0].offsetHeight / 2;
	var dh = getWinSize().height;
	var objtop = dh / 2 + st - 205;
	$('#order')[0].style.top = objtop + 'px';
	$('#order')[0].style.display = 'block';
}
function showOrder()
{	
	$('#order').innerHTML = '';
 	if (document.documentElement) {
		st = document.documentElement.scrollTop;
 	}
 	if (st == 0)
 	{
		if (document.body) {
			st = document.body.scrollTop;
		}
 	}
          
	$.ajax({
			url: '/ajax/order/index.html?return=html&rnd=' + new Date().getTime(),             // указываем URL и
			dataType : "html",                     // тип загружаемых данных
			success: function (data, textStatus) { // вешаем свой обработчик на функцию success
				if(data != 'Error') {
					$('#order')[0].innerHTML = data;
				}
			}
			});
			
 	var objh = $('#order')[0].offsetHeight / 2;
	var dh = getWinSize().height;
	var objtop = dh / 2 + st - 205;
	$('#order')[0].style.top = objtop + 'px';
	$('#order')[0].style.display = 'block';
}
function showMap()
{
	if (document.documentElement) {
		st = document.documentElement.scrollTop;
	}
	if (st == 0)
	{
		if (document.body) {
			st = document.body.scrollTop;
		}
	}

	new Ajax.Updater('mapItem', '/ajax/get_map/index.html?return=html&' + new Date().getTime(), 
           {method: 'get', evalScripts: true});
	var dh = getWinSize().height;
	var dw = getWinSize().width;
	var objtop = dh / 2 + st - 240;
	var objleft = dw / 2  - 330;
	$('mapItem').style.top = objtop + 'px';
	$('mapItem').style.left = objleft + 'px';
	$('mapItem').style.display = 'block';
}
function showKupon()
{
	if (document.documentElement) {
		st = document.documentElement.scrollTop;
	}
	if (st == 0)
	{
		if (document.body) {
			st = document.body.scrollTop;
		}
	}
 	new Ajax.Updater('kuponItem', '/ajax/get_kupon/index.html?return=html&' + new Date().getTime(), 
           {method: 'get', evalScripts: true});
 	var dh = getWinSize().height;
 	var dw = getWinSize().width;
 	var objtop = dh / 2 + st - 220;
 	var objleft = dw / 2  - 360;
 	$('kuponItem').style.top = objtop + 'px';
 	$('kuponItem').style.left = objleft + 'px';
 	$('kuponItem').style.display = 'block';

}

function showPage(p)
{
	if (document.documentElement) {
		st = document.documentElement.scrollTop;
	}
	if (st == 0)
	{
		if (document.body) {
			st = document.body.scrollTop;
		}
	}
 	new Ajax.Updater('pageItem', '/page/'+p+'/index.html', 
           {method: 'get', evalScripts: true});
 	var dh = getWinSize().height;
 	var dw = getWinSize().width;
// 	var objtop = dh / 2 + st - 300;
 	var objtop = 50;
 	var objleft = dw / 2  - 360;
 	$('pageItem').style.top = objtop + 'px';
 	$('pageItem').style.left = objleft + 'px';
 	$('pageItem').style.display = 'block';
	return false;
}

 
