
/*--------------------------------------------------------------------------------
--------------------------------------------------------------------------------*/

	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");
		}
	});
	
	

/*--------------------------------------------------------------------------------
--------------------------------------------------------------------------------*/

sfHover = function() {
	if(document.getElementById("nav"))
	{
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*--------------------------------------------------------------------------------
Storm tracking
--------------------------------------------------------------------------------*/

var __stormJs = 'js.stormIQ.com/sid0001_4.003.js';

var TrackBasket = function(){};var TrackCustParam = function(){};var saleTrack = new TrackBasket(), customTrack = new TrackCustParam();
TrackBasket.prototype.addSaleItem =function($ic, $iv, $m1, $m2, $m3, $m4){var $t=[];$t[0]=$ic;$t[1]=$iv;$t[2]=($m1===undefined)?"":$m1;$t[3]=($m2===undefined)?"":$m2;$t[4]=($m3===undefined)?"":$m3;$t[5]=($m4===undefined)?"":$m4;__ofsi.push($t);};
TrackBasket.prototype.logSale =function($i){__ofic=$i;};
TrackCustParam.prototype.logCustomParameter = function (){};
TrackCustParam.prototype.addCustomParameter =function ($k,$v){var $t=[];$t[0] = $k;$t[1] = $v;__ofcp.push($t);};
TrackCustParam.prototype.logStoredParameters = function (){};
function rdr($r,$n){if($r!==undefined){if ($r.href!==undefined){$r.href=$r;}else{if($n===undefined){$n="";}if ($n.toLowerCase()==='true'){window.open($r);}else{self.location=$r;}}}}
function logOCSale($p, $r, $n){var $t=[];$t[0]=$p;$t[1]=$r;$t[2]=$n;__ofcs.push($t);rdr($r,$n);}
function logOCSearch($s, $p, $d){var $t=[];$t[0]=$s;$t[1]=$p;$t[2]=$d;__ofsr.push($t);}
function logOCPV($p, $r, $n){var $t=[];$t[0]=$p;$t[1]=$r;$t[2]=$n;__ofpv.push($t);rdr($r,$n);}
function genProc($arg){}
function stormInst(){__stormJs =  __stormJs.replace('https://', '').replace('http://', '');__stormJs=__prt+__stormJs;var scr=document.createElement('script');scr.setAttribute('type','text/javascript');scr.setAttribute('src',__stormJs);document.getElementsByTagName('head')[0].appendChild(scr);}var __pxi = new Image(1,1), __ofsi=[], __ofcp=[],__ofcs=[],__ofsr=[],__ofpv=[],__ofic, __prt;__prt=(("https:"==document.location.protocol)?"https://":"http://");if(typeof(__stormJs)!=='undefined'){try{var $px = (__stormJs.replace('https://', '').replace('http://', '')).split('/')[0];__pxi.onload=stormInst;__pxi.src=__prt + $px + "/px.gif";}catch(e){}}

/*--------------------------------------------------------------------------------
Prototype - open PDFs in new window, remove numbers from FAQ answers, nav bar force IE6 
--------------------------------------------------------------------------------*/

document.observe("dom:loaded", function() { 
//$$('a[href$=".pdf"]').each(function(link){  link.writeAttribute('target','_blank'); });
$$('div.questionandanswerlist h3').each(function(headline){ 
	var withnumbers = headline.innerHTML;
	var withoutnumbers = withnumbers.sub('^[0-9]+\. ', '');
	headline.update(withoutnumbers);
	});
$$('div#main_nav li.selected a').each(function(ielink){ ielink.addClassName('ie6navon'); });
$$('div#main_nav li.parent > a').each(function(ielink2){ ielink2.addClassName('ie6navon'); });	
 // $$('#p-trial ul#nav li.selected a').setStyle({ backgroundColor: '#695d54',color: '#fff'});	
});



