var dialog_default="<img src='/images/layout/loading.gif' width=32 height=32 align=middle><span style='height:32px'>Lütfen bekleyiniz.</span>"; 
var windowWidth;
var windowHeight;
var pageOffsetX;
var pageOffsetY;

function wndRegisterForm() {
	modalWindowAc('user/register.php','Yeni Üye',450,300);
}
function wndLoginForm() {
	modalWindowAc('user/login.php','Giriş',480,260);
}
function wndLostPasswordForm() {
	modalWindowAc('user/recovery.php','Şifremi Unuttum',500,260);
}
function wndChangePasswordForm() {
	modalWindowAc('user/password.php','Şifre Değişikliği',350,330);
}

function refreshPage() {
	window.location.reload(false);
}

/*reuired*/
function eventResize() {
	getWindowSize();
	getPageOffset();
	
	if (document.getElementById('modal_window_overlay').style.display=="block") {
		document.getElementById('modal_window_overlay').style.height=windowHeight+'px';
		document.getElementById('modal_window_overlay').style.width=windowWidth+'px';
		showCenterDiv('modal_window_div',0,0);
	}
	
	if (document.getElementById('modal_dialog_overlay').style.display=="block") {
		document.getElementById('modal_dialog_overlay').style.height=windowHeight +'px';
		document.getElementById('modal_dialog_overlay').style.width=windowWidth +'px';	
		showCenterDiv('modal_dialog_div',0,0);
	}
	
}

/*reuired*/
function init() {
	window.onresize = eventResize;
	loadScroll();
}

function isInteger(s) {
	var isInteger_re = /^\s*\d+\s*$/;
	return String(s).search (isInteger_re) != -1
}

function isDigitOnly (s) {
	var isWhole_re = /^\s*\d+\s*$/;
	return String(s).search (isWhole_re) != -1
}

/*reuired*/
function ajaxPost(pageAddress,parameters) {
	
	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				return null;
			}
		}
	}
		
	ajaxRequest.open("POST", pageAddress, true);
	ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
	ajaxRequest.send(parameters); 
	
	return ajaxRequest;
}

/*reuired*/
function ajax(pageAddress) {
	
	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				return null;
			}
		}
	}
		
	ajaxRequest.open("GET", pageAddress, true);
	ajaxRequest.send(null); 
	
	return ajaxRequest;
}

/*reuired*/
function getPageOffset() {
	if(!window.pageYOffset)
	{
		//strict mode
		if(!(document.documentElement.scrollTop == 0))
		{
			offsetY = document.documentElement.scrollTop;
			offsetX = document.documentElement.scrollLeft;
		}
		//quirks mode
		else
		{
			offsetY = document.body.scrollTop;
			offsetX = document.body.scrollLeft;
		}
	}
	//w3c
	else
	{
		offsetX = window.pageXOffset;
		offsetY = window.pageYOffset;
	}
	pageOffsetX=offsetX;
	pageOffsetY=offsetY;
}

/*reuired*/
function getWindowSize() {

	if(!window.innerWidth) {
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else
		{
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	//w3c
	else
	{
		w = window.innerWidth;
		h = window.innerHeight;
	}

	windowWidth=w;
	windowHeight=h;
}

/*reuired*/
function showCenterDiv(divid,w,h) {

	var div = document.getElementById(divid);
	if (w==0) w=parseInt(div.style.width.replace("px",""));
	if (h==0) h=parseInt(div.style.height.replace("px",""));

	var x = 0;
	var y = 0;
	var offsetX = 0;
	var offsetY = 0;
	//IE
	if(!window.pageYOffset)
	{
		//strict mode
		if(!(document.documentElement.scrollTop == 0))
		{
			offsetY = document.documentElement.scrollTop;
			offsetX = document.documentElement.scrollLeft;
		}
		//quirks mode
		else
		{
			offsetY = document.body.scrollTop;
			offsetX = document.body.scrollLeft;
		}
	}
	//w3c
	else
	{
		offsetX = window.pageXOffset;
		offsetY = window.pageYOffset;
	}

	x = ((windowWidth-w)/2)+offsetX;
	y = ((windowHeight-h)/2)+offsetY;
	

	div.style.position = "absolute";
	div.style.top = y + "px";
	div.style.left = x + "px";
	div.style.width = w+"px";
	div.style.height = h+"px";
	div.style.display = "block";
	
}

function modalDialogAcX(page,title,w,h,params) {

	document.getElementsByTagName("body")[0].style.overflow = "hidden";

	showOverlay('modal_dialog_overlay');
	document.getElementById('modal_dialog_head').innerHTML=title;
	document.getElementById('modal_dialog_head').width=w-20;
	document.getElementById('modal_dialog_body').innerHTML=dialog_default;
	document.getElementById('modal_dialog_kapat_x').style.visibility="hidden";
	
	showCenterDiv('modal_dialog_div',w,h);
	
	var ar=ajaxPost(page,params);
	ar.onreadystatechange = function(){
		if (ar.readyState == 4) {
			if (ar.responseText.indexOf('<script>')==0)
				eval(ar.responseText.replace("<script>","").replace("</script>",""));
			else
				document.getElementById('modal_dialog_body').innerHTML=ar.responseText;
		}
	}

}

/*reuired*/
function modalDialogAc(page,title,w,h,params) {

	document.getElementsByTagName("body")[0].style.overflow = "hidden";

	showOverlay('modal_dialog_overlay');
	document.getElementById('modal_dialog_head').innerHTML=title;
	document.getElementById('modal_dialog_head').width=w-20;
	document.getElementById('modal_dialog_body').innerHTML=dialog_default;
	document.getElementById('modal_dialog_kapat_x').style.visibility="visible";
	
	showCenterDiv('modal_dialog_div',w,h);
	
	var ar=ajaxPost(page,params);
	ar.onreadystatechange = function(){
		if (ar.readyState == 4) {
			if (ar.responseText.indexOf('<script>')==0)
				eval(ar.responseText.replace("<script>","").replace("</script>",""));
			else
				document.getElementById('modal_dialog_body').innerHTML=ar.responseText;
		}
	}

}

/*reuired*/
function modalWindowAc(page,title,w,h) {

	document.getElementsByTagName("body")[0].style.overflow = "hidden";

	showOverlay('modal_window_overlay');
	document.getElementById('modal_window_head').innerHTML=title;
	document.getElementById('modal_window_head').width=w-20;
	document.getElementById('modal_window_body').innerHTML=dialog_default;
	
	showCenterDiv('modal_window_div',w,h);

	var ar=ajax(page);
	ar.onreadystatechange = function(){
		if (ar.readyState == 4) {
			document.getElementById('modal_window_body').innerHTML=ar.responseText;
		}
	}

}

/*reuired*/
function modalWindowKapat() {
	document.getElementsByTagName("body")[0].style.overflow = "auto";
	document.getElementById('modal_window_div').style.display='none';
	document.getElementById('modal_window_overlay').style.display='none';
}

/*reuired*/
function modalDialogKapat() {
	document.getElementsByTagName("body")[0].style.overflow = "auto";
	document.getElementById('modal_dialog_div').style.display='none';
	document.getElementById('modal_dialog_overlay').style.display='none';
}

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function getDocWidth() {
    var D = document;
    return Math.max(document.documentElement["clientWidth"], document.body["scrollWidth"], document.documentElement["scrollWidth"], document.body["offsetWidth"], document.documentElement["offsetWidth"]);
}


/*required*/
function showOverlay(divid) {
	getWindowSize();
	
	document.getElementById(divid).style.height=getDocHeight()+'px';
	document.getElementById(divid).style.width=windowWidth +'px';
	document.getElementById(divid).style.display="block";
}

function reg_form_post() {

	var k3=document.getElementById('reg_eposta').value;	
	var k1=document.getElementById('reg_isim').value;
	var k2=document.getElementById('reg_soyisim').value;
	var k4=document.getElementById('reg_captcha').value;
	
	var uy=document.getElementById('reg_uyari');	
	var hata="";

	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (!filter.test(k3)) {
		hata=hata+"E-Posta sahasına geçerli bir e-posta giriniz.<br>";
	}	
	if (k1.length<2) {
		hata=hata+"İsim sahasına uygun bir veri giriniz.<br>";
	}
	if (k2.length<2) {
		hata=hata+"Soyisim sahasına uygun bir veri giriniz.<br>";
	}	
	if (k4.length!=6) {
		hata=hata+"Güvenlik kodu sahasına resimdeki 6 karakteri giriniz.<br>";
	}	
	
	if (hata.length>0) {
		uy.innerHTML=hata;
		uy.style.visibility='visible';
	} else {
		uy.style.visibility='hidden';
		
		var inputs = document.getElementsByTagName("*");
		var params="";

		for(var i = 0; i < inputs.length; i++) {
			if (inputs[i].id.indexOf('reg') == 0) {
				params=params+inputs[i].name+"="+encodeURIComponent(inputs[i].value)+"&";
			}
		}
		
		modalDialogAc('user/add.php','Üye Kayıt',300,150,params)
		
	}
	
}

function rnd_form_post(dil) {

	var k1=document.getElementById('rnd_tckimlik').value;
	var k2=document.getElementById('rnd_adisoyadi').value;
	var k3=document.getElementById('rnd_yas').value;
	var k4=document.getElementById('rnd_cinsiyet').value;
	var k5=document.getElementById('rnd_telefon').value;
	
	var k6=document.getElementById('rnd_hastane').options[document.getElementById('rnd_hastane').selectedIndex].value;
	var k7=document.getElementById('rnd_bolum').options[document.getElementById('rnd_bolum').selectedIndex].value;
	var k8=document.getElementById('rnd_doktor').options[document.getElementById('rnd_doktor').selectedIndex].value;
	var k9=document.getElementById('rnd_tarih').value;
	var k10=document.getElementById('rnd_saat').value;
	var k11=document.getElementById('rnd_captcha').value;
	
	var uy=document.getElementById('rnd_uyari');
	
	var hata="";
	
	if (k1.length>0) {
		if (k1.length!=11) hata=hata+"T.C. Kimlik sahasına 11 karakter girmelisiniz.<br>";
		if (!isDigitOnly(k1)) hata=hata+"T.C. Kimlik sahasına sadece sayısal karakter girmelisiniz.<br>";
	} else {
		if (k2.length<5) hata=hata+"Adı Soyadı sahasına uygun bir veri giriniz<br>";
		if (k3.length==0) hata=hata+"Yaşı sahasına uygun bir veri giriniz<br>";
		if (k4.length==0) hata=hata+"Cinsiyet seçiniz<br>";
	}
	
	if (k3.length!=0 && !isDigitOnly(k3)) hata=hata+"Yaşı sahasına sadece sayısal değer giriniz<br>";
	if (k5.length==0 || (k5.length!=0 && (!isDigitOnly(k5) || k5.length!=11))) hata=hata+"Telefon kısmına uygun bir değer giriniz<br>";
	if (k6=='*') hata=hata+"Hastane seçiniz<br>";
	if (k7=='-1') hata=hata+"Bölüm seçiniz<br>";
	if (k8=='-1') hata=hata+"Doktor seçiniz<br>";
	if (k9.length!=10) hata=hata+"Tarih giriniz<br>";
	if (k10.length!=5) hata=hata+"Saat seçiniz<br>";
	if (k11.length!=6) hata=hata+"Güvenlik kodunu 6 karakter olarak giriniz<br>";
	
	if (hata.length>0) {
		uy.innerHTML=hata;
		uy.style.visibility='visible';
	} else {
		uy.style.visibility='hidden';
		var params=getFormParams('rnd');
		modalDialogAcX('randevu/kaydet.php','Randevu Kayıt',400,200,params);
	}
	
}

function pwd_form_post(h1,h2,h3,h4) {

	var k1=document.getElementById('pwd_password_old').value;
	var k2=document.getElementById('pwd_password_new1').value;
	var k3=document.getElementById('pwd_password_new2').value;
	var k4=document.getElementById('pwd_captcha').value;

	var uy=document.getElementById('pwd_uyari');

	var hata="";

	if (k1.length==0) {
		hata=hata+h1+".<br>";
	}
	if (k2.length<6 || k3.length<6) {
		hata=hata+h2+".<br>";
	}
	if (k2!=k3) {
		hata=hata+h4+".<br>";
	}	
	if (k4.length!=6) {
		hata=hata+h3+".<br>";
	}	
	
	if (hata.length>0) {
		uy.innerHTML=hata;
		uy.style.visibility='visible';
	} else {
		uy.style.visibility='hidden';
		var params=getFormParams('pwd');
		modalDialogAc('user/change.php','Şifre Değişikliği',300,150,params)
	}

}

function getFormParams(formprefix) {
	var inputs = document.getElementsByTagName("*");
	var params="";

	for(var i = 0; i < inputs.length; i++) {
		if (inputs[i].id.indexOf(formprefix) == 0) {
			params=params+inputs[i].name+"="+encodeURIComponent(inputs[i].value)+"&";
		}
	}	
	return params;
}

function lst_form_post(h1,h2) {

	var k1=document.getElementById('lst_eposta').value;
	var k2=document.getElementById('lst_captcha').value;
	var uy=document.getElementById('lst_uyari');

	var hata="";

	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (!filter.test(k1)) {
		hata=hata+h1+".<br>";
	}
	if (k2.length!=6) {
		hata=hata+h2+".<br>";
	}	
	
	if (hata.length>0) {
		uy.innerHTML=hata;
		uy.style.visibility='visible';
	} else {
		uy.style.visibility='hidden';
		var params=getFormParams('lst');
		modalDialogAc('user/sendmail.php','Şifremi Unuttum',300,150,params)
	}

}

function log_form_post(h1,h2,h3) {

	var k1=document.getElementById('log_eposta').value;
	var k2=document.getElementById('log_sifre').value;
	var k3=document.getElementById('log_captcha').value;
	var uy=document.getElementById('log_uyari');

	var hata="";

	if (k2.length<6) {
		hata=hata+h2+".<br>";
	}	
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (!filter.test(k1)) {
		hata=hata+h1+".<br>";
	}
	if (k3.length!=6) {
		hata=hata+h3+".<br>";
	}	
	
	if (hata.length>0) {
		uy.innerHTML=hata;
		uy.style.visibility='visible';
	} else {
		uy.style.visibility='hidden';
		var params=getFormParams('log');
		modalDialogAc('user/logon.php','Üye Girişi',300,150,params)
	}

}

function seriNesneKilitle(adi) {
	var inputs = document.getElementsByTagName("*");
	
	for(var i = 0; i < inputs.length; i++) {
		if (inputs[i].id.indexOf(adi) == 0) {
			inputs[i].disabled=true;
		}
	}
	
}

function seriNesneAc(adi) {

	var inputs = document.getElementsByTagName("*");
	
	for(var i = 0; i < inputs.length; i++) {
		if (inputs[i].id.indexOf(adi) == 0) {
			inputs[i].disabled=false;
		}
	}

}

function getSelectedValue(cmbId) {
	return document.getElementById(cmbId).options[document.getElementById(cmbId).selectedIndex].value;
}

function saatCubukYukle(objId,hastane,bolum,doktor,tarih) {

	seriNesneKilitle(objId.substring(0,3));
	var ar=ajax('randevu/saatler.php?hastane='+hastane+'&bolum='+bolum+'&doktor='+doktor+'&tarih='+tarih);

	ar.onreadystatechange = function(){
		if (ar.readyState == 4) {
			seriNesneAc(objId.substring(0,3));
			document.getElementById(objId).innerHTML=ar.responseText;
		}
	}

}

function doktorComboYukle(cmbId,hastane,bolum) {

	seriNesneKilitle(cmbId.substring(0,3));
	var ar=ajax('randevu/doktorlar.php?hastane='+hastane+'&bolum='+bolum+'&objid='+cmbId);

	ar.onreadystatechange = function(){
		if (ar.readyState == 4) {
			eval(ar.responseText);
			seriNesneAc(cmbId.substring(0,3));
			document.getElementById(cmbId).focus();
		}
	}

}

function bolumComboYukle(cmbId,hastane) {

	seriNesneKilitle(cmbId.substring(0,3));
	var ar=ajax('randevu/bolumler.php?hastane='+hastane+'&objid='+cmbId);

	ar.onreadystatechange = function(){
		if (ar.readyState == 4) {
			eval(ar.responseText);
			seriNesneAc(cmbId.substring(0,3));
			document.getElementById(cmbId).focus();
		}
	}

}

function loadUserLoginModal() {

	var ar=ajax('user/login.php');
	
	ar.onreadystatechange = function(){
		if (ar.readyState == 4) {
			document.getElementById('modalUserLoginBody').innerHTML=ar.responseText;
			document.getElementById('modelUserLoginTitle').innerHTML='Üye Girişi';
		}
	}

	revealModal('modalUserLogin');

}

function revealModal(divID) {
    window.onscroll = function () { 
		document.getElementById(divID).style.top = document.body.scrollTop; 
	};
    document.getElementById(divID).style.display = "block";
	//NLBfadeBg(divID,'#ffffff','#000000','1000');
    document.getElementById(divID).style.top = document.body.scrollTop;
}

function hideModal(divID) {
	//NLBfadeBg(divID,'#000000','#ffffff','1000');
    document.getElementById(divID).style.display = "none";
}

function imgover(obj,w,h) {
	document.getElementById(obj).style.width=w+10;
	document.getElementById(obj).style.height=((w+10)*h)/w;
}

function imgout(obj,w,h) {
	document.getElementById(obj).style.width=w;
	document.getElementById(obj).style.height=h;
}

function fxover(obj) {
	NLBfadeBg(obj,'#1c94e3','#90c9f0','50');
}

function fxout(obj) {
	NLBfadeBg(obj,'#90c9f0','#1c94e3','250');
}

function toggle(id,obj) {
	var state = document.getElementById(id).style.display;
	
	document.getElementById(id).style.left=zxcPos(document.getElementById(obj))[0]-1+'px';
	document.getElementById(id).style.top=zxcPos(document.getElementById(obj))[1]+15+'px';	

	if (state == 'block') {
		document.getElementById(id).style.display = 'none';
	} else {
		document.getElementById(id).style.display = 'block';
	}
}

function zxcPos(obj){
	var rtn=[obj.offsetLeft,obj.offsetTop];
	while(obj.offsetParent!=null){
		var objp=obj.offsetParent;
		rtn[0]+=objp.offsetLeft-objp.scrollLeft;
		rtn[1]+=objp.offsetTop-objp.scrollTop;
		obj=objp;
	}
	return rtn;
}

function doctoron(id) {
	document.getElementById(id).className = "drkartviziton";
}

function doctoroff(id) {
	document.getElementById(id).className = "drkartvizitoff";
}

function menuon(id) {
	document.getElementById(id).className = "lefton";
	NLBfadeBg(id,'#ffffff','#90c9f0','50');
}

function menuoff(id) {
	document.getElementById(id).className = "leftoff";
	NLBfadeBg(id,'#90c9f0','#ffffff','200');
}

function tabon(id) {
	document.getElementById(id).className = "tabon";
	NLBfadeBg(id,'#1c94e3','#90c9f0','50');
}

function taboff(id) {
	document.getElementById(id).className = "taboff";
	NLBfadeBg(id,'#90c9f0','#1c94e3','300');
}

function saatsec(sid,objid,adi) {
	var tds = document.getElementsByTagName("td");
	for(var i = 0; i < tds.length; i++) {
		if (tds[i].id.indexOf('saat') == 0 && tds[i].className=="saatselected") {
			document.getElementById(tds[i].id).className = "saatoff";
			NLBfadeBg(tds[i].id,'#1ce394','#1c94e3','300');
		}
		if (tds[i].id==sid) {
			document.getElementById(tds[i].id).className = "saatselected";
			NLBfadeBg(tds[i].id,'#90c9f0','#1ce394','300');
		}
	}
	document.getElementById(objid).value=adi;
}

function saaton(id) {
	if (document.getElementById(id).className != "saatselected") {
		document.getElementById(id).className = "saaton";
		NLBfadeBg(id,'#1c94e3','#90c9f0','50');
	}
}

function saatoff(id) {
	if (document.getElementById(id).className != "saatselected") {
		document.getElementById(id).className = "saatoff";
		NLBfadeBg(id,'#90c9f0','#1c94e3','300');
	}
}

var db = (document.body) ? 1 : 0;
var scroll = (window.scrollTo) ? 1 : 0;

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else {
    begin += 2;
  }
  var end = document.cookie.indexOf(";", begin);
  if (end == -1) end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function saveScroll() {
  if (!scroll) return;
  var now = new Date();
  now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
  var x = (db) ? document.body.scrollLeft : pageXOffset;
  var y = (db) ? document.body.scrollTop : pageYOffset;
  setCookie("xy", x + "_" + y, now);
}

function loadScroll() {

	


  if (!scroll) return;
  var xy = getCookie("xy");
  if (!xy) return;
  var ar = xy.split("_");
  if (ar.length == 2) scrollTo(parseInt(ar[0]), parseInt(ar[1]));
}

window.size = function() {
var w = 0;
var h = 0;
//IE
if(!window.innerWidth)
{
//strict mode
if(!(document.documentElement.clientWidth == 0))
{
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
//quirks mode
else
{
w = document.body.clientWidth;
h = document.body.clientHeight;
}
}
//w3c
else
{
w = window.innerWidth;
h = window.innerHeight;
}
return {width:w,height:h};
}

window.center = function() {
var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:0};
var _x = 0;
var _y = 0;
var offsetX = 0;
var offsetY = 0;
//IE
if(!window.pageYOffset)
{
//strict mode
if(!(document.documentElement.scrollTop == 0))
{
offsetY = document.documentElement.scrollTop;
offsetX = document.documentElement.scrollLeft;
}
//quirks mode
else
{
offsetY = document.body.scrollTop;
offsetX = document.body.scrollLeft;
}
}
//w3c
else
{
offsetX = window.pageXOffset;
offsetY = window.pageYOffset;
}
_x = ((this.size().width-hWnd.width)/2)+offsetX;
_y = ((this.size().height-hWnd.height)/2)+offsetY;
return{x:_x,y:_y};
}

