function init ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("clock").appendChild ( timeDisplay );
}
 
function updateClock ( )
{

  var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	
  var currentTime = new Date ( );

  // Extracting date fields from the date object currentTime
  var currentDate = currentTime.getDate ( );
  var currentMonth = currentTime.getMonth ( ) + 1;
  var currentYear = currentTime.getFullYear( ); 
 
  // Extracting time fields from the date object currentTime
  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );
 
  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
 
  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
 
  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
 
  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for displaying date and time
  var currentTimeString = days[currentTime.getDay()]  + " " + currentDate + "/" + currentMonth + "/" + currentYear + " "+ currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
 
  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

function message()
{
		var txt=""
		try
		{
			adddlert("Welcome guest!");
		}
		catch(err)
		{
			txt="Dear JMHeal User.\n\n";
			txt+="This functionaliy will be coming soon,\n";
			txt+="Please visit this page again.\n\n";
			if(!confirm(txt))
    			{
				document.location.href="http://localhost/JMHeal/JMHealIndex.php";
			}
		}
}


////////////////////////////////////

var popup="JMHeal :: Sorry! right-click is disabled on our website!"; 

function stopRClick(go) 
{ 
	if  (document.all) 
	{ 
		if (event.button == 2) 
		{ 
			alert(popup); 
			return false; 
		}
	 } 
	if (document.layers) 
	{ 
		if (go.which == 3) 
		{ 
			alert(popup); return false; 
		} 
	}
} 
if (document.layers) 
{ 
	document.captureEvents(Event.MOUSEDOWN); 
} 
document.onmousedown	=	stopRClick;


 function popup_window(url,w,h) 
 {
	 var width=w;  
	 var height=h;  
	 var from_top=550;  
	 var from_left=500;  
	 var toolbar='no';  
	 var location='no';  
	 var directories='no';  
	 var status='no';  
	 var menubar='no';  
	 var scrollbars='yes';  
	 var resizable='no';  
	 var atts='width='+width+'show,height='+height+',top='+from_top+',screenY=';  atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar;  atts+=',location='+location+',directories='+directories+',status='+status;  atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable;  window.open(url,'win_name',atts); 
 } 


function openPopUp(el) {
     var newWin = window.open('url','name','resize=no');
     newWin.focus();
}

function init ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("clock").appendChild ( timeDisplay );
}
 
function updateClock ( )
{

  var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	
  var currentTime = new Date ( );

  // Extracting date fields from the date object currentTime
  var currentDate = currentTime.getDate ( );
  var currentMonth = currentTime.getMonth ( ) + 1;
  var currentYear = currentTime.getFullYear( ); 
 
  // Extracting time fields from the date object currentTime
  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );
 
  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
 
  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
 
  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
 
  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for displaying date and time
  var currentTimeString = days[currentTime.getDay()]  + " " + currentDate + "/" + currentMonth + "/" + currentYear + " "+ currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
 
  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

function Greetings()
{
	//To print the greeting message
	var currentTime = new Date()
	var hours = currentTime.getHours()
	var minutes = currentTime.getMinutes()
	if (minutes < 12)
	{
		minutes = "0" + minutes
	}

	if(hours<12)
	{
		document.write("Good Morning");
	}
	else if( ( hours >= 12 ) && ( hours <= 16 ) )
	{
		document.write("Good Afternoon")
	} 
	else if(hours >16)
	{
		document.write("Good Evening")
	}
}
