
// JavaScript Document
startList = function() {
//code only for IE
if(!document.body.currentStyle) return;
var subs = document.getElementsByName('submenu');
for(var i=0; i<subs.length; i++) {
var li = subs[i].parentNode;
if(li && li.lastChild.style) {
li.onmouseover = function() {
this.lastChild.style.visibility = 'visible';
}
li.onmouseout = function() {
this.lastChild.style.visibility = 'hidden';
}
}
}
}
window.onload=startList;
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function poplinks(url)
{
newwindow=window.open(url,'ImageDisplay','height=400,width=600,left=0,top=0,resizable=yes,scrollbars=yes');
if (window.focus) {newwindow.focus()}
}
function confirmMsg(msg){
if(!confirm(msg)){
return false;
} else {
return true;
}
}
function mylogin_validate(){
if(document.frmlogin.txtuser.value == "")
{
alert("E-posta adresinizi girin");
document.frmlogin.txtuser.focus();
return false;
}
if(document.frmlogin.txtpassword.value == "")
{
alert("Sifrenizi girin");
document.frmlogin.txtpassword.focus();
return false;
}
}
function showdoctor(x)
{
window.location.href="pastappointments.php?txtsearch="+x;
}
function searchdoctor(x)
{
window.location.href="myappointments.php?txtsearch="+x;
}
/*function change_searchtype(type,x)
{
var doctorid=document.frm_search.doctorid.value;
if(type == "past")
window.location.href="pastappointments.php?keyword="+x+"&docid="+doctorid;
else
window.location.href="myappointments.php?keyword="+x+"&docid="+doctorid;
}*/
function search_validate(){
//if(document.frmsearch.catid.value == "" || document.frmsearch.searchkey.value==""){
if(document.frmsearch.catid.value == ""){
alert("Lutfen doktorunuzun uzmanlik alanini ya da Sehrini secin.");
return false;
}	
return true;
}

function msg_validate(){
	if(document.frm_msg.roger.value == "")
	{
	alert("Lutfen Bir konu girin.");
	document.frm_msg.roger.focus();
	return false;
	}
		if(document.frm_msg.description.value == "")
	{
	alert("Lutfen bir mesaj yazın.");
	document.frm_msg.description.focus();
	return false;
	}
	
}

function patientlogin_validate(){
	if(document.frmpatlogin.txtuser1.value == "")
	{
	alert("E-posta adresinizi girin.");
	document.frmpatlogin.txtuser1.focus();
	return false;
	}
	if(document.frmpatlogin.txtpassword1.value == "")
	{
	alert("Sifrenizi girin.");
	document.frmpatlogin.txtpassword1.focus();
	return false;
	}
}

function secretarylogin_validate(){
	if(document.frmseclogin.txtuser2.value == "")
	{
	alert("E-posta adresinizi girin.");
	document.frmseclogin.txtuser2.focus();
	return false;
	}
	if(document.frmseclogin.txtpassword2.value == "")
	{
	alert("Sifrenizi girin.");
	document.frmseclogin.txtpassword2.focus();
	return false;
	}
}


function changepassword_validate(){
if(document.frm_changepassword.txtoldpass.value == "")
{
alert("Eski sifrenizi girin.");
document.frm_changepassword.txtoldpass.focus();
return false;
}
if(document.frm_changepassword.txtpassword.value == "")
{
alert("Yeni sifrenizi girin.");
document.frm_changepassword.txtpassword.focus();
return false;
}
var passlen = document.frm_changepassword.txtpassword.value;
if(passlen.length < 6)
{
alert("Sifreniz en az 6 karakterden olusmalidir.");
document.frm_changepassword.txtpassword.focus();
return false;
}
if(document.frm_changepassword.txtpassword.value != document.frm_changepassword.confpassword.value)
{
alert("Girdiginiz sifreler birbiriyle ayni olmalidir.");
document.frm_changepassword.confpassword.value="";
document.frm_changepassword.confpassword.focus();
return false;
}
}
function contact_validate(){
var FullName=document.frmcontact.FullName.value;
if(FullName == "")
{
alert("Lutfen isminizi girin.");
document.frmcontact.FullName.focus();
return false;
}
if(document.frmcontact.Email.value == "")
{
alert("Lutfen e-posta adresinizi girin.");
document.frmcontact.Email.focus();
return false;
}
if (!validateEmail(document.frmcontact.Email.value,1,1)) 
{
document.frmcontact.Email.focus();
return false;
}
}
//Doctor Account Create
function doctor_register(){
if(document.frm_doctor.firstname.value == "")
{
alert("Lutfen adinizi girin.");
document.frm_doctor.firstname.focus();
return false;
}
else if(document.frm_doctor.lastname.value == "")
{
alert("Lutfen soyadinizi girin.");
document.frm_doctor.lastname.focus();
return false;
}
else if(document.frm_doctor.txt_qual.value == "")
{
alert("Lutfen unvaninizi girin.");
document.frm_doctor.txt_qual.focus();
return false;
}
else if(document.frm_doctor.catid.value == "")
{
alert("Lutfen uzmanliginizi secin.");
document.frm_doctor.catid.focus();
return false;
}
else if(document.frm_doctor.specialtyid.value == "")
{
alert("Lutfen ozel uzmanlik alaninizi secin.");
document.frm_doctor.specialtyid.focus();
return false;
}
else if(document.frm_doctor.email.value == "")
{
alert("Lutfen e-posta adresinizi girin.");
document.frm_doctor.email.focus();
return false;
}
else if (!validateEmail(document.frm_doctor.email.value,1,1)) 
{
document.frm_doctor.email.focus();
return false;
}
else if(document.frm_doctor.phone.value == "")
{
alert("Lutfen bir telefon numara girin.");
document.frm_doctor.phone.focus(); 
return false;
}
else if(document.frm_doctor.city.value == "0")
{
alert("Lutfen sehrinizi secin.");
document.frm_doctor.city.focus();
return false;
}
else if(document.frm_doctor.areaid.value == "0")
{
alert("Lutfen semtinizi secin.");
document.frm_doctor.areaid.focus();
return false;
}
else if(document.frm_doctor.address.value == "")
{
alert("Lutfen adresinizi girin.");
document.frm_doctor.address.focus();
return false;
} 
else {
//confirmMsg("Are you sure you want to register this account?");
var msg="Girdiginiz bilgilerle sisteme kaydiniz yapilacaktir.";
if(!confirm(msg)){
return false;
ap1=document.getElementById("formdisp");
if(ap1){
ap1.style.display="block";
ap1.style.visibility="visible";
}
ap=document.getElementById("progressbar");
if(ap){
ap.style.display="none";
}
} else {
return true;
ap1=document.getElementById("progressbar");
if(ap1){
ap1.style.display="block";

}
ap=document.getElementById("formdisp");
if(ap){
ap.style.display="none";
}
}
}
}
function bookdelete_validate(){
var msg="Bu saati silmek istediginizden emin misiniz?";
if(!confirm(msg)){
return false;
}
else{
return true;
}
}
function SEO_validate(){
var msg="Bu Profil degistirmeyi istediginizden emin misiniz?";
if(!confirm(msg)){
return false;
}
else{
return true;
}
}
//Patient Booking
function bookingconf(){
var msg="Randevunuzu kesinlestirmek istiyor musunuz?";
if(!confirm(msg)){
return false;
}
else {
return true;
}
}
function sanction_validate(){
if(document.frm_book.txtvisitreason.value == ""){
alert("Lutfen randevu sebebinizi secin.");
document.frm_book.txtvisitreason.focus();
return false;
}
}
function Confirmbook(bid,docid){
var msg="Randevunuzu kesinlestirmek istiyor musunuz?";
if(!confirm(msg)){
return false;
}
else {
//return true;
//document.form1.action="bookingpayment.php?Bookid="+bid+"&doctorid="+docid+"";				
document.form1.action="booking_confirm.php?Bookid="+bid+"&doctorid="+docid+"";
document.form1.submit();
}
}
function Cancelbook(bid){
var msg="Randevunuzu iptal etmek istediginizden emin misiniz?";
if(!confirm(msg)){
return false;
}
else {
window.location.href = "cancelappointment.php?bookingid="+bid+"";
}
}

function Updatebook(bid,st,end,week,docid){
document.form1.action="sanction.php?bookid="+bid+"&sttime="+st+"&endtime="+end+"&weekday="+week+"&doctorid="+docid+" ";
document.form1.submit();
}
//Manual Booking
function booking_validate(){
if(document.frm_book.rdo_booktype[0].checked == true){
if(document.frm_book.txtsearch.value == "")
{
alert("Lutfen aradiginiz kelimeyi yazin.");
document.frm_book.txtsearch.focus();
return false;
} 
if(document.frm_book.patientid.value == "")
{
alert("Lutfen hastanin e-posta adresini secin.");
document.frm_book.patientid.focus();
return false;
}
else if(document.frm_book.patientid.value == "No Patients")
{
alert("Bu hasta kayitli degil. Lutfen rezervasyon turunu degistirin.");
document.frm_book.patientid.focus();
return false;
}
}
else if(document.frm_book.rdo_booktype[1].checked == true){
if(document.frm_book.txtpatientname2.value == "")
{
alert("Lutfen hastanin adini girin.");
//document.frm_book.txtpatientname.focus();
return false;
}
if(document.frm_book.txtpatientemail.value == "")
{
alert("Lutfen hastanin e-posta adresini girin.");
document.frm_book.txtpatientemail.focus();
return false;
}
if (!validateEmail(document.frm_book.txtpatientemail.value,1,1)) 
{
document.frm_book.txtpatientemail.focus();
return false;
}
}
else if(document.frm_book.rdo_booktype[2].checked == true){
if(document.frm_book.txtotherreason.value == "")
{
alert("Lutfen diger sebebi girin.");
document.frm_book.txtotherreason.focus();
return false;
}
}
if(document.frm_book.txtvisitreason.value == "")
{
alert("Lutfen ziyaret sebebini girin.");
document.frm_book.txtvisitreason.focus();
return false;
}
else {
var msg="Randevunuzu kesinlestirmek istiyor musunuz?";
if(!confirm(msg)){
return false;
}
else {
return true;
}
}
}
//Doctor More Infor Requisition 
function doctormoreinfo_validate(){
if(document.frm_doctor.firstname.value == "")
{
alert("Lutfen adinizi girin.");
document.frm_doctor.firstname.focus();
return false;
}
if(document.frm_doctor.lastname.value == "")
{
alert("Lutfen soyadinizi girin.");
document.frm_doctor.lastname.focus();
return false;
}
if(document.frm_doctor.sex.value == "Female")
{
if(document.frm_doctor.maidenname.value == "")
{
alert("Lutfen kizlik soyadinizi girin.");
document.frm_doctor.maidenname.focus();
return false;
}
}
if(document.frm_doctor.txt_qual.value == "")
{
alert("Lutfen unvaninizi girin.");
document.frm_doctor.txt_qual.focus();
return false;
}
if(document.frm_doctor.catid.value == "")
{
alert("Lutfen uzmanliginizi secin.");
document.frm_doctor.catid.focus();
return false;
}
if(document.frm_doctor.specialtyid.value == "Choose")
{
alert("Lutfen ozel uzmanlik alaninizi secin.");
document.frm_doctor.specialtyid.focus();
return false;
}
if(document.frm_doctor.address.value == "")
{
alert("Lutfen ");
document.frm_doctor.address.focus();
return false;
}
if(document.frm_doctor.city.value == "0")
{
alert("Lutfen sehri secin.");
document.frm_doctor.city.focus();
return false;
}
if(document.frm_doctor.areaid.value == "Choose")
{
alert("Lutfen bolgeyi secin.");
document.frm_doctor.areaid.focus();
return false;
}
if(document.frm_doctor.email.value == "")
{
alert("Lutfen e-posta adresinizi girin.");
document.frm_doctor.email.focus();
return false;
}
if (!validateEmail(document.frm_doctor.email.value,1,1)) 
{
document.frm_doctor.email.focus();
return false;
}
if(document.frm_doctor.acceptcreditcard[0].checked == false && document.frm_doctor.acceptcreditcard[1].checked == false){
alert("Lutfen kredi kartini kabul edip etmediginizi isaretleyin.");
return false;
}
/*if(document.frm_doctor.txtpassword.value == "")
{
alert("Lutfen sifrenizi girin.");
document.frm_doctor.txtpassword.focus();
return false;
}
if(document.frm_doctor.txtpassword.value == "")
{
alert("Lutfen sifrenizi girin.");
document.frm_doctor.txtpassword.focus();
return false;
}
var passlen = document.frm_doctor.txtpassword.value;
if(passlen.length < 6 || passlen.length > 12)
{
alert("Sifrenizin uzunlugu 6 ila 12 karakter arasinda olmalidir.");
document.frm_doctor.txtpassword.focus();
return false;
}
if(document.frm_doctor.txtpassword.value != document.frm_doctor.confpassword.value)
{
alert("Lutfen ayni sifreyi tekrar girin.");
document.frm_doctor.confpassword.value="";
document.frm_doctor.confpassword.focus();
return false;
}
if(document.frm_doctor.directions.value == "")
{
alert("Lutfen adresinizi girin.");
document.frm_doctor.directions.focus();
return false;
}
if(document.frm_doctor.dircity.value == "")
{
alert("Lutfen sehrinizi secin.");
document.frm_doctor.dircity.focus();
return false;
}
if(document.frm_doctor.dirstate.value == "")
{
alert("Please enter the State.");
document.frm_doctor.dirstate.focus();
return false;
}
if(document.frm_doctor.dirCountry.value == "")
{
alert("Lutfen ulkenizi secin.");
document.frm_doctor.dirCountry.focus();
return false;
}*/
return true;
}
//Doctor More Info Requisition 
function doctormoreinformation_validate(){
if(document.frm_doctor.firstname.value == "")
{
alert("Lutfen adinizi girin.");
document.frm_doctor.firstname.focus();
return false;
}
if(document.frm_doctor.lastname.value == "")
{
alert("Lutfen soyadinizi girin.");
document.frm_doctor.lastname.focus();
return false;
}
if(document.frm_doctor.txt_qual.value == "")
{
alert("Lutfen unvaninizi girin.");
document.frm_doctor.txt_qual.focus();
return false;
}
if(document.frm_doctor.catid.value == "")
{
alert("Lutfen ozel uzmanlik alaninizi secin.");
document.frm_doctor.catid.focus();
return false;
}
if(document.frm_doctor.specialtyid.value == "Choose")
{
alert("Lutfen uzmanlik alaninizi secin.");
document.frm_doctor.specialtyid.focus();
return false;
}
if(document.frm_doctor.address.value == "")
{
alert("Lutfen adresinizi girin.");
document.frm_doctor.address.focus();
return false;
}
if(document.frm_doctor.city.value == "0")
{
alert("Lutfen sehrinizi secin.");
document.frm_doctor.city.focus();
return false;
}
if(document.frm_doctor.areaid.value == "Choose")
{
alert("Lutfen Semt bilgilerinizi secin.");
document.frm_doctor.areaid.focus();
return false;
}
if(document.frm_doctor.email.value == "")
{
alert("Lutfen e-posta adresinizi girin.");
document.frm_doctor.email.focus();
return false;
}
if (!validateEmail(document.frm_doctor.email.value,1,1)) 
{
document.frm_doctor.email.focus();
return false;
}
if(document.frm_doctor.acceptcreditcard[0].checked == false && document.frm_doctor.acceptcreditcard[1].checked == false){
alert("Lutfen kredi kartiniz gecerli olup olmadigini belirtin.");
return false;
}
if(document.frm_doctor.tckimlik.value == "")
{
alert("Lutfen T.C. Kimlik  numaranizi girin.");
document.frm_doctor.email.focus();
return false;
}
else {
var msg="Girdiginiz bilgilerle sisteme kaydiniz yapilacaktir.";
if(!confirm(msg)){
return false;
ap1=document.getElementById("formdisp");
if(ap1){
ap1.style.display="block";
ap1.style.visibility="visible";
}
ap=document.getElementById("progressbar");
if(ap){
ap.style.display="none";
ap.style.visibility="hidden";
}
} else {
return true;
ap1=document.getElementById("progressbar");
if(ap1){
ap1.style.display="block";
ap1.style.visibility="visible";
}
ap=document.getElementById("formdisp");
if(ap){
ap.style.display="none";
ap.style.visibility="hidden";
}
}
}
}
function doctorpass_validate(){
if(document.form1.txtpassword.value == "")
{
alert("Lutfen sifrenizi girin.");
document.form1.txtpassword.focus();
return false;
}
var passlen = document.form1.txtpassword.value;
if(passlen.length < 6)
{
alert("Sifreniz en az 6 karakterden olusmalidir.");
document.form1.txtpassword.focus();
return false;
}
if(document.form1.confpassword.value == "")
{
alert("Lutfen sifrenizi tekrar girin.");
document.form1.confpassword.focus();
return false;
}
if(document.form1.txtpassword.value != document.form1.confpassword.value)
{
alert("Girdiginiz iki sifre birbiriyle ayni olmalidir.");
document.form1.confpassword.value="";
document.form1.confpassword.focus();
return false;
}
}
//Patient Account Create
function patient_validate(){
if(document.frm_patient.firstname.value == "")
{
alert("L�tfen ad1n1z1 girin.");
document.frm_patient.firstname.focus();
return false;
}
if(document.frm_patient.lastname.value == "")
{
alert("Lutfen soyadinizi girin.");
document.frm_patient.lastname.focus();
return false;
}
if(document.frm_patient.city.value == "0")
{
alert("Lutfen _ehrinizi seuin.");
document.frm_patient.city.focus();
return false;
}
if(document.frm_patient.areaid1.value == "")
{
alert("Lutfen bulgenizi seuin.");
document.frm_patient.areaid1.focus();
return false;
}	
if(document.frm_patient.email.value == "")
{
alert("Lutfen e-posta adresinizi girin.");
document.frm_patient.email.focus();
return false;
}
if (!validateEmail(document.frm_patient.email.value,1,1)) 
{
document.frm_patient.email.focus();
return false;
}
if(document.frm_patient.password.value == "")
{
alert("Lutfen sifrenizi girin.");
document.frm_patient.password.focus();
return false;
}
var passlen = document.frm_patient.password.value;
if(passlen.length < 6)
{
alert("Sifreniz en az 6 karakterden olusmalidir.");
document.frm_patient.password.focus();
return false;
}
if(document.frm_patient.password.value != document.frm_patient.confpassword.value)
{
alert("Lutfen ayni sifreyi tekrar girin.");
document.frm_patient.confpassword.value="";
document.frm_patient.confpassword.focus();
return false;
}
else {
var msg="Girdiğiniz bilgilerle sisteme kaydiniz yapilacaktir.";
if(!confirm(msg)){
return false;
}
else {
return true;
}
}
}
//Email Validation Script
function validateEmail(addr,man,db) {
if (addr == '' && man) {
if (db) alert('E-posta adresi zorunludur.');
return false;
}
var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
for (i=0; i<invalidChars.length; i++) {
if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
if (db) alert('E-posta adresiniz geuersiz karakterler iuermektedir.');
return false;
}
}
for (i=0; i<addr.length; i++) {
if (addr.charCodeAt(i)>127) {
if (db) alert("Email address contains non ascii characters.");
return false;
}
}
var atPos = addr.indexOf('@',0);
if (atPos == -1) {
if (db) alert('Email address must contain an @');
return false;
}
if (atPos == 0) {
if (db) alert('Email address must not start with @');
return false;
}
if (addr.indexOf('@', atPos + 1) > - 1) {
if (db) alert('Email address must contain only one @');
return false;
}
if (addr.indexOf('.', atPos) == -1) {
if (db) alert('Email address must contain a period in the domain name');
return false;
}
if (addr.indexOf('@.',0) != -1) {
if (db) alert('period must not immediately follow @ in email address');
return false;
}
if (addr.indexOf('.@',0) != -1){
if (db) alert('period must not immediately precede @ in email address');
return false;
}
if (addr.indexOf('..',0) != -1) {
if (db) alert('two periods must not be adjacent in email address');
return false;
}
var suffix = addr.substring(addr.lastIndexOf('.')+1);
if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
if (db) alert('invalid primary domain in email address');
return false;
}
return true;
}
//Function phone validation Script
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;
function isInteger(s)
{   var i;
for (i = 0; i < s.length; i++)
{   
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}
function stripCharsInBag(s, bag)
{   var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++)
{   
// Check that current character isn't whitespace.addimg_validate
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}
function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
function showBookingtype(){
if (document.frm_book.rdo_booktype[0].checked ){
reguserst = document.getElementById("reguser");
if(reguserst){
reguserst.style.display="block";
reguserst.style.visibility="visible";
}
unreguserst = document.getElementById("unreguser");
if(unreguserst){
unreguserst.style.display="none";
unreguserst.style.visibility="hidden";
}
manualst = document.getElementById("manual");
if(manualst){
manualst.style.display="none";
manualst.style.visibility="hidden";
}
}
if (document.frm_book.rdo_booktype[1].checked){
reguserst = document.getElementById("reguser");
if(reguserst){
reguserst.style.display="none";
reguserst.style.visibility="hidden";
}
unreguserst = document.getElementById("unreguser");
if(unreguserst){
unreguserst.style.display="block";
unreguserst.style.visibility="visible";
}
manualst = document.getElementById("manual");
if(manualst){
manualst.style.display="none";
manualst.style.visibility="hidden";
}
}
if (document.frm_book.rdo_booktype[2].checked){
reguserst = document.getElementById("reguser");
if(reguserst){
reguserst.style.display="none";
reguserst.style.visibility="hidden";
}
unreguserst = document.getElementById("unreguser");
if(unreguserst){
unreguserst.style.display="none";
unreguserst.style.visibility="hidden";
}
manualst = document.getElementById("manual");
if(manualst){
manualst.style.display="block";
manualst.style.visibility="visible";
}
}
}
function forget_validate()
{
if(document.frm_forgetpass.txtEmail.value == "")
{
alert("Lutfen kayitli e-posta adresinizi girin");
document.frm_forgetpass.txtEmail.focus();
return false;
}
if(!validateEmail(document.frm_forgetpass.txtEmail.value,1,1))
{
document.frm_forgetpass.txtEmail.focus();
return false;
}
}
function removeCommas(aNum) {
//remove any commas
aNum=aNum.replace(/,/g,"");
//remove any spaces
aNum=aNum.replace(/\s/g,"");
return aNum;
}
function bookmarksite(title, url) {
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
alert("Press Ctrl D keys to bookmark our site");
}
/*var url = "http://www.doktoragit.com";
var title = "Doktoragit";
function makeLink(){
if(document.all)
window.external.AddFavorite(url,title);
}
*/
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=1,width=500,height=400');");
}


function changeDoctor(doctorid)
{
window.open("secretarymyaccount.php?setDoctorId="+doctorid,"_top");
}
