
/*--------------------------------------------------------------------------------
--------------------------------------------------------------------------------*/

	Event.observe(window, 'load', function(){
		
		if ($('subscribe_form'))
		{
			$('subscribe_form').onsubmit = function() {
			
				var value = $F('subscribeEmail');
				
				re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
				if (!value || !re.test(value))
				{
					alert('Please enter a valid email address!');
					return false;
				}
			
			}
		}
											 
	});

/*--------------------------------------------------------------------------------
	Nature of enquiry select menu.
	Sets the menu to load sub-pages when particular options are selected.
--------------------------------------------------------------------------------*

	Event.observe(window, 'load', function(){
		
		if ($('natureOfEnquiry'))
		{
			$('natureOfEnquiry').onchange = function()
			{
				var value = this.value;
				if (value == 'request-a-demo' || value == 'feedback')
				{
				//	alert(this.value);
					window.location = this.value
				}
			}
		}
											 
	});


/*--------------------------------------------------------------------------------
--------------------------------------------------------------------------------*/

	function bookmark(title, url)
	{
		// Firefox
		if (window.sidebar)
		{
			window.sidebar.addPanel(title, url,"");
		}
		
		// Opera
		else if (window.opera && window.print)
		{
		   var elem = document.createElement('a');
		   elem.setAttribute('href', url);
		   elem.setAttribute('title', title);
		   elem.setAttribute('rel', 'sidebar');
		   elem.click();
		} 
		
		// IE
		else if (document.all)
		{
		   window.external.AddFavorite(url, title);
		}
	}
	
	function createCookie(name,value,days) 
	{
		if (days) 
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else 
		{	
			var expires = "";
		}
		
		document.cookie = name+"="+value+expires+"; path=/";
	}
	
	function readCookie(name) 
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		
		for(var i=0;i < ca.length;i++) 
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		
		return null;
	}
	
	function eraseCookie(name) 
	{
		createCookie(name,"",-1);
	}
	
	function resizeText(multiplier) 
	{ 
		if (document.body.style.fontSize == "") 
		{  
			document.body.style.fontSize = "0.8em";  
		}  
		
		document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.2) + "em";
		
		createCookie("fontSize", document.body.style.fontSize, 30);
	}
	
	Object.extend(Event, {
	  _domReady : function() {
		if (arguments.callee.done) return;
		arguments.callee.done = true;
	
		if (this._timer)  clearInterval(this._timer);
		
		this._readyCallbacks.each(function(f) { f() });
		this._readyCallbacks = null;
	},
	  onDOMReady : function(f) {
		if (!this._readyCallbacks) {
		  var domReady = this._domReady.bind(this);
		  
		  if (document.addEventListener)
			document.addEventListener("DOMContentLoaded", domReady, false);
			
			/*@cc_on @*/
			/*@if (@_win32)
				document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
				document.getElementById("__ie_onload").onreadystatechange = function() {
					if (this.readyState == "complete") domReady(); 
				};
			/*@end @*/
			
			if (/WebKit/i.test(navigator.userAgent)) { 
			  this._timer = setInterval(function() {
				if (/loaded|complete/.test(document.readyState)) domReady(); 
			  }, 10);
			}
			
			Event.observe(window, 'load', domReady);
			Event._readyCallbacks =  [];
		}
		Event._readyCallbacks.push(f);
	  }
	});
	
	Event.onDOMReady(function() {
							  
		if(readCookie("fontSize"))
		{
			document.body.style.fontSize = readCookie("fontSize");
		}
	});
	
	

/*--------------------------------------------------------------------------------
--------------------------------------------------------------------------------*/



