function inc(filename)
{
   var body = document.getElementsByTagName('body').item(0);
   script = document.createElement('script');
   script.src = filename;
   script.type = 'text/javascript';
   body.appendChild(script)
}

// Source the StrategyMix javascript used by this script.
// 2010-11-30: PR disabled for now, as not working properly in IE or Safari
/*
inc("https://apj3.smixexpress.com/express/smix_cookie_process.js");
inc("https://apj3.smixexpress.com/express/date.js");
*/
	  

/**
 *
 */
function analytics(client_system, page_name, strategymix_url)
{
   // Default values for function parameters.
   client_system   = typeof(client_system)   != 'undefined' ? client_system : 'nobel1';
   page_name       = typeof(page_name)       != 'undefined' ? page_name : 'NoPageSpecified';
   strategymix_url = typeof(strategymix_url) != 'undefined' ? strategymix_url : 'apj3.smixexpress.com/express/';

   //
   var system_name = client_system;
   var v_page_name = page_name;
   var v_smix_url  = strategymix_url;
	
   var from_page      = document.referrer;
   var v_http_referer = escape(from_page);
   v_http_referer     = v_http_referer.replace("&", "%24");
	
   //	
   var wx_param  = get_url_dx('dx');
   var sx_param  = get_url_dx('sx');
   var wx_random = ''; 
	
   // If no WX cookie found, create a new one.
   if (Get_Cookie('wx_random_cookie')==null || Get_Cookie('wx_random_cookie')=='') {
      wx_random = system_name+'_'+new Date().format('yyyyMMddHHmmss');
      Set_Cookie( 'wx_random_cookie', wx_random, '5000', '/', '', '' );

   // Otherwise use the details from the WX cookie that was found.
   } else {
      wx_random = Get_Cookie('wx_random_cookie');
   }
	
   //Set DX cookie if DX in URL
   if (Get_Cookie('wx_cookie') != null && Get_Cookie('wx_cookie') != '') {
      ;
   } else if ( wx_param != null) {
      Set_Cookie( 'wx_cookie', wx_param, '1', '/', '', '' );
   }
	
   var SmixHost = (("https:" == document.location.protocol) ? "https://" : "http://");
   document.write(unescape(('%3Cimg width="0" height="0" src="'+SmixHost+v_smix_url+'web_track_page.cfm?page_name='+v_page_name+'&dx='+wx_param+'&sx='+sx_param+'&system_name='+system_name+'&dx_random_cookie='+Get_Cookie('wx_random_cookie')+'&v_http_referer='+escape(v_http_referer)+'"%3E')));
}


/**
 *
 */
function landing_page(ax, iframe_width, iframe_height, strategymix_url)
{
   // Default value for function parameters.
   strategymix_url = typeof(strategymix_url) != 'undefined' ? strategymix_url : 'apj3.smixexpress.com/express/';
   iframe_width    = typeof(iframe_width)    != 'undefined' ? iframe_width    : '100%';
   iframe_height   = typeof(iframe_height)   != 'undefined' ? iframe_height   : '800';

   //
   function get_url_ax(name)
	{  
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
	  var regexS = "[\\?&#038;]"+name+"=([^&#]*)";  
	  var regex = new RegExp( regexS );  
	  var results = regex.exec( window.location.href );  if( results == null )    
	  return ""; else return results[1];
	}

   var default_ax_param = ax;
   var ax_param = get_url_ax('ax');
   var dx_param = get_url_dx('dx');
   var v_iframe_url='https://' + strategymix_url;
   if ((ax_param == null) || (ax_param =='')) { ax_param = default_ax_param; }
   document.write('<iframe src="'+v_iframe_url+'register.cfm?ax='+ax_param+'&#038;wxrc='+Get_Cookie('wx_random_cookie')+'&#038;dx='+dx_param+'" mce_src="'+v_iframe_url+'register.cfm?ax='+ax_param+'&amp;wxrc='+Get_Cookie('wx_random_cookie')+'&amp;dx='+dx_param+'" width="'+iframe_width+'" height="'+iframe_height+'" frameborder="0" scrolling="no">Your browser does not support iframes.</iframe>');
}

