﻿//-----------------open new window------------------------//
function newwindow_blank(url){
	window.open(url.href);
}
function window_close(url){
	window.close(url.href);
}
function newwindow_self(url){
	window.location.href=url.href;
}
function newwindow_url(url){
	window.location.href=url;
}
function popupwindow(url,width,height){
	var wleft = (screen.width - width) / 2;
  	var wtop = (screen.height - height) / 2;
	vwindow = window.open(url, 'x','toolbar=0 ,width='+width+' ,height='+height+',left='+wleft+',top='+wtop+'', 'status=0' );
	vwindow.focus();
}
function popupwindow1(url,width,height){
	var vLink;
		vLink = url;
		var wleft = (screen.width - width) / 2;
		var wtop = (screen.height - height) / 2;		
		vwindow = window.open(vLink, 'x','toolbar=0 ,width='+width+' ,height='+height+',scrollbars=yes');
		vwindow.resizeTo(width, height);
		vwindow.moveTo(wleft, wtop);
		//window.location.reload();
		vwindow.focus();		
}
function chkLogin(){
	if(confirm(altLogin)){
		window.location.href='index.php';
		return true;
	}else{
		return false;
	}
}
function chkSearch(){
var vName=document.frmsearch.rTxtName;
	if(vName.value==''||vName.value==altFindUser){
		alert(altSearch);
		return false
	}else{
		document.frmsearch.submit();
		return true;
	}
}
function confirmDelete(){
	if(window.confirm(delAccount)){
		document.frm_showprofile.submit();
		return true;
	}else{
		return false;
	}
}
function confirmDeleteAddress(){
	if(confirm("Do you want to delete this address?")){
		return true;
	}else{
		return false;	
	}
}
function changeTabMenu(tab,fmb,d,y,m){
		if(tab=='tabScheduleM'){
			$(tab).className='tab1Active';
			$('tabDialyM').className='tab2';
			$('menuleftDate').href='schedule_show.php?fmb_id='+fmb+'&day='+d+'&month='+m+'&year='+y+'';
		}
		if(tab=='tabDialyM'){
			$(tab).className='tab1Active';
			$('tabScheduleM').className='tab2';
			$('menuleftDate').href='diary_show.php?fmb_id='+fmb+'&diaD='+d+'&diaY='+y+'&diaM='+m+'';
		}
}
//Show Or Hide Province
function showProv(obj){
	var chkShow=document.getElementById('chkShow').value;
	if(chkShow=='show'){
		document.getElementById('showProvince').style.display="block";
		document.getElementById('chkShow').value="hide";
	}else if(chkShow=='hide'){
		document.getElementById('showProvince').style.display="none";
		document.getElementById('chkShow').value="show";
	}
}



