/*

Author: Mark McDonnell [ mark [at] storm-media [dot] co [dot] uk ]

Application Date: 2005.10.24 / Monday.

*/

// Global Variables

	var d = document;
	
// DOM Functions
	
	function $(objID)
	{
		return d.getElementById(objID);
	}
	
// Popup Window Function

	var Popup = {
		open: function(domain, w, h, toggle)
		{
			this.options = {
				url: domain,
				width: w,
				height: h,
				scrollbars: toggle,
				left: screen.width / 2 - (w / 2),
				top: screen.height / 2 - (h / 2)
			}
			
			window.open(this.options.url, '', 'resizable=yes, width=' + this.options.width + ',height=' + this.options.height + ',scrollbars=' + this.options.scrollbars + ',left=' + this.options.left + ',top=' + this.options.top);
		}
	}

// Event Function

function fnAddEvent(obj, evType, fn, useCapture)
{
	if (obj.addEventListener) { // Gecko browsers (Mozilla / Firefox)
		obj.addEventListener(evType, fn, useCapture);
		return true;
	} else if (obj.attachEvent) { // Internet Explorer 5+
		var r = obj.attachEvent('on' + evType, fn);
		return r;
	} else { // This sets the event handler for NS4 & IE5/Mac.
		elm['on' + evType] = fn;
	}
}

// Misc Functions

	var SideNav = {
		Display: function(obj)
		{
			switch (obj) {
				case 'CosmeticDentistry':
					storeObj = 'id-Nav-' + obj;
					break;
					
				case 'Dentistry':
					storeObj = 'id-Nav-' + obj;
					break;
					
				case 'BeautySpa':
					storeObj = 'id-Nav-' + obj;
					break;
					
				case 'InsideOurLab':
					storeObj = 'id-Nav-' + obj;
					break;
			}
			
			if ($(storeObj) == null || $(storeObj) == 'undefined') {
				return false;
			} else {
				if ($(storeObj).style.display == 'none') {
					$(storeObj).style.display = 'block'
				} else {
					$(storeObj).style.display = 'none';	
				}
			}
		}
	}
	
// ABOUT SUB MENU
	
	var SubNav1 = {
		Display: function(obj, state)
		{
			if ($('id-Navigation-Services').style.display == 'block') {
				// hide the other sub nav first!
				$('id-Navigation-Services').style.display = 'none';
				
				// start back into showing the current sub menu!
				storeObj = 'id-Navigation-About';
				
				if ($(storeObj) == null || $(storeObj) == 'undefined') {
					return false;
				} else {
					clearTimeout(subTimeout2);
					$(storeObj).style.display = 'block';					
				}
			} else {
				storeObj = 'id-Navigation-About';
				
				if ($(storeObj) == null || $(storeObj) == 'undefined') {
					return false;
				} else {
					if ($(storeObj).style.display == 'none') {
						$(storeObj).style.display = 'block';
					} else {
						clearTimeout(subTimeout1);
					}
				}
			}
		},
		
		Hide: function(obj)
		{
			storeObj = 'id-Navigation-About';
			
			if ($(storeObj) == null || $(storeObj) == 'undefined') {
				return false;
			} else {
				if ($(storeObj).style.display == 'block') {
					subTimeout1 = setTimeout("$(storeObj).style.display = 'none'", 200); // this prevents the sub menu from being hidden immediately.
				}
			}
		},
		
		Prevent: function()
		{
			clearTimeout(subTimeout1);
		},
		
		Remove: function()
		{
			subTimeout1 = setTimeout("$(storeObj).style.display = 'none'", 200); // this prevents the sub menu from being hidden immediately.
		}
	}
	
	
// SERVICES SUB MENU

	var SubNav2 = {
		Display: function(obj, state)
		{
			if ($('id-Navigation-About').style.display == 'block') {
				// hide the other sub nav first!
				$('id-Navigation-About').style.display = 'none';
				
				// start back into showing the current sub menu!
				storeObj = 'id-Navigation-Services';
				
				if ($(storeObj) == null || $(storeObj) == 'undefined') {
					return false;
				} else {
					clearTimeout(subTimeout1);
					$(storeObj).style.display = 'block';					
				}
			} else {
				storeObj = 'id-Navigation-Services';
				
				if ($(storeObj) == null || $(storeObj) == 'undefined') {
					return false;
				} else {
					if ($(storeObj).style.display == 'none') {
						$(storeObj).style.display = 'block';
					} else {
						clearTimeout(subTimeout2);
					}
				}
			}
		},
		
		Hide: function(obj)
		{
			storeObj = 'id-Navigation-Services';
			
			if ($(storeObj) == null || $(storeObj) == 'undefined') {
				return false;
			} else {
				if ($(storeObj).style.display == 'block') {
					subTimeout2 = setTimeout("$(storeObj).style.display = 'none'", 200); // this prevents the sub menu from being hidden immediately.
				}
			}
		},
		
		Prevent: function(obj)
		{
			clearTimeout(subTimeout2);
		},
		
		Remove: function()
		{
			subTimeout2 = setTimeout("$(storeObj).style.display = 'none'", 200); // this prevents the sub menu from being hidden immediately.
		}
	}
	
// ABOUT TEAM MEMBERS

	var TeamMembers = {
		Toggle: function(obj)
		{
			switch (obj) {
				case 1:
					obj = 'id-AboutTeam-1';
					break;
				
				case 2:
					obj = 'id-AboutTeam-2';
					break;
				
				case 3:
					obj = 'id-AboutTeam-3';
					break;
				
				case 4:
					obj = 'id-AboutTeam-4';
					break;
			}
			
			if ($(obj) == null || $(obj) == 'undefined') {
				return false;
			} else {
				if ($(obj).style.display == 'block') {
					$(obj).style.display = 'none';
				} else {
					$(obj).style.display = 'block';
				}
			}
		}
	}
	
// SERVICES: COSMETIC DENTISTRY

	var ServicesCD = {
		Toggle: function(obj)
		{
			switch(obj) {
				case 1:
					obj = 'id-ServicesCD-1';
					break;
				
				case 2:
					obj = 'id-ServicesCD-2';
					break;
				
				case 3:
					obj = 'id-ServicesCD-3';
					break;
				
				case 4:
					obj = 'id-ServicesCD-4';
					break;
				
				case 5:
					obj = 'id-ServicesCD-5';
					break;
			}
			
			if ($(obj) == null || $(obj) == 'undefined') {
				return false;
			} else {
				if ($(obj).style.display == 'block') {
					$(obj).style.display = 'none';
				} else {
					$(obj).style.display = 'block';
				}
			}
		}
	}
	
// SERVICES: DENTISTRY

	var ServicesDentistry = {
		Toggle: function(obj)
		{
			switch (obj) {
				case 1:
					obj = 'id-ServicesDentistry-1';
					break;
				
				case 2:
					obj = 'id-ServicesDentistry-2';
					break;
				
				case 3:
					obj = 'id-ServicesDentistry-3';
					break;
			}
			
			if ($(obj) == null || $(obj) == 'undefined') {
				return false;
			} else {
				if ($(obj).style.display == 'block') {
					$(obj).style.display = 'none';
				} else {
					$(obj).style.display = 'block';
				}
			}
		}
	}
	
// SERVICES: BEAUTY SPA

	var ServicesBeautySpa = {
		Toggle: function(obj)
		{
			switch (obj) {
				case 1:
					obj = 'id-ServicesBeautySpa-1';
					break;
				
				case 2:
					obj = 'id-ServicesBeautySpa-2';
					break;
				
				case 3:
					obj = 'id-ServicesBeautySpa-3';
					break;
			}
			
			if ($(obj) == null || $(obj) == 'undefined') {
				return false;
			} else {
				if ($(obj).style.display == 'block') {
					$(obj).style.display = 'none';
				} else {
					$(obj).style.display = 'block';
				}
			}
		}
	}
	
// TESTIMONIALS

	var Testimonials = {
		Toggle: function(obj)
		{
			switch (obj) {
				case 1:
					obj = 'id-Testimonials-1';
					break;
				
				case 2:
					obj = 'id-Testimonials-2';
					break;
				
				case 3:
					obj = 'id-Testimonials-3';
					break;
			}
			
			if ($(obj) == null || $(obj) == 'undefined') {
				return false;
			} else {
				if ($(obj).style.display == 'block') {
					$(obj).style.display = 'none';
				} else {
					$(obj).style.display = 'block';
				}
			}
		}
	}
	
	
