// JavaScript Document

//Command to set the window name to Soothe for use within pop ups and linking between browser windows etc
window.name="Soothe";

//Function to open pop up windows
function GlobalPopUp(theURL,winName,features)
	{
	return window.open(theURL,winName,features);
	}
	
//Function to open pop up window and focus on it - Extends above function
//for this to work you must use window.name to name your new window
function GlobalFocusPopUp(theURL,winName,features)
	{
	NewWindow = GlobalPopUp(theURL,winName,features);
	window.NewWindow.focus();
	return NewWindow;
	}
function BookAppointment()
	{
	alert("******* Customer Service Message *******\n\nSorry, this service is temporarily unavailable.\nPlease call +44 (0)794 634 5738 to make an appointment.\n\nWe apologise for any inconvenience this may cause.");
	//alert("******* Customer Service Message *******\n\nDo you need an appointment today?\n\nAlthough this booking service is very accurate, last minute cancellations can take up to 30 minutes to appear online.\n\Therefore, if you require an emergency appointment today but cannot find a free slot on-line, please call our booking line on 0161 8346118 to see if any last minute cancellations have been been requested.\n\nWe look forward to seeing you soon!\n\nThe Soothe Clinic Team.");
	/*NewWindow = GlobalFocusPopUp('http://www.appointmentsnow.com/CUI3/Login.aspx?facility_id=671&ref=http://www.sootheclinic.com/booking_confirm.aspx','SootheOnlineBooking','menubar=yes,scrollbars=yes,width=760,height=425,top=50,left=60,screenX=60,screenY=50,resizable=yes');*/
	/*NewWindow = GlobalFocusPopUp('http://www.tm2online.co.uk/sootheclinic','SootheOnlineBooking','menubar=yes,scrollbars=yes,width=760,height=425,top=50,left=60,screenX=60,screenY=50,resizable=yes');*/
	}
function ViewClinic(theURL)
	{
	NewWindow = GlobalFocusPopUp(theURL,'SootheClinicInfo','menubar=yes,scrollbars=yes,width=500,height=425,top=50,left=60,screenX=60,screenY=50,resizable=yes');
	}
	
//Function to load booking confirmation screen in opening window so that the google tracking works
function TellGoogle()
	{
	if (opener != null)
		{
		opener.location = "booking_confirm.aspx";
		opener.focus();
		window.close();
		}
	else
		{
		top.window.moveTo(0,0); 
		if (document.all) 
			{
			top.window.resizeTo(screen.availWidth,screen.availHeight);
			} 
		else if (document.layers || document.getElementById) 
			{ 
			if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth)
				{
				top.window.outerHeight = top.screen.availHeight; 
				top.window.outerWidth = top.screen.availWidth;
				} 
			} 
		}
	}

function LinkFromPopUp(theUrl)
	{
	if (opener != null)
		{
		opener.location = theUrl;
		opener.focus();
		window.close();
		}
	else
		{
		window.location = theUrl;
		top.window.moveTo(0,0); 
		if (document.all) 
			{
			top.window.resizeTo(screen.availWidth,screen.availHeight);
			} 
		else if (document.layers || document.getElementById) 
			{ 
			if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth)
				{
				top.window.outerHeight = top.screen.availHeight; 
				top.window.outerWidth = top.screen.availWidth;
				} 
			} 
		}
	}
	
//Cookie function - this code is used to assign and interogate a cookie value 
function getCookieData(LabelName)
	{	
	var LabelLength = LabelName.length;
	var CookieData = document.cookie;
	var CookieLength = CookieData.length;
	var i = 0;
	var CookieEnd;
	while (i < CookieLength)
		{
		var j = i + LabelLength;
		if (CookieData.substring(i,j) == LabelName)
			{
			CookieEnd = CookieData.indexOf(";",j);
			if (CookieEnd == -1)
				{
				CookieEnd = CookieData.length;
				}
			return unescape(CookieData.substring(j+1, CookieEnd));
			}
		i++;
		}
	return "";
	}
