﻿
function ignoreErrors() 
{
    return true;
}
window.onerror = ignoreErrors;

var ROV_Delay = '';
var ROV_RandomDate = new Date();
var ROV_RandNum = new String(Math.random());
var ROV_Secure = 0;


var ROV_VisitID = '1096950926';
var ROV_VisitorID = '1114307158';
if(typeof(ROV_head)=='undefined'){	var ROV_head = document.getElementsByTagName('HEAD')[0];}var ROV_isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var ROV_isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
var ROV_HREF = document.location.href.toString();
var ROV_HREF_Encoded = encodeURIComponent(ROV_HREF);


// Cookie Code

function ROV_setCookie2(name, value, expires, path, domain, secure) 
{
	try
	{
		var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");

		document.cookie = curCookie;
	}

	catch(e)
	{}
}

function ROV_setCookie(name, value, expires)
{
	 ROV_setCookie2(name, value, expires, '/');
}

function ROV_getCookie(name) 
{
	var retval;

	try
	{
		var dc = document.cookie;
		var prefix = name + "=";
		var begin = dc.indexOf("; " + prefix);

		if (begin == -1) 
		{
			begin = dc.indexOf(prefix);
			if (begin != 0) 
			{
				return null;
			}
		} 
		else
		{
			begin += 2;
		}

		var end = document.cookie.indexOf(";", begin);
		if (end == -1)
		{
			end = dc.length;
		}

		retval =  unescape(dc.substring(begin + prefix.length, end));
	}

	catch(e)
	{}

	return retval;
}

function ROV_deleteCookie(name, path, domain) 
{
	if (getCookie(name)) 
	{
		document.cookie = name + "=" + 
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function ROV_fixDate(date) 
{
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0)
	{
		date.setTime(date.getTime() - skew);
	}
}

// Plugin Detection Code


var ROV_detection_string = "";
var ROV_msie_windows = 0;
var ROV_pluginVersion = 0;

if (ROV_isIE && ROV_isWin)
{
     ROV_msie_windows = 1;
     document.writeln('<SCRIPT LANGUAGE="VBScript" TYPE="text/vbscript">');

     document.writeln('Dim ROV_detect_through_vb');
     document.writeln('ROV_detect_through_vb = 0');
     document.writeln('If ScriptEngineMajorVersion >= 2 then');
     document.writeln('     ROV_detect_through_vb = 1');
     document.writeln('End If');

     document.writeln('Function ROV_activeXDetect(activeXname)');
     document.writeln('     on error resume next');
     document.writeln('     If ScriptEngineMajorVersion >= 2 then');
     document.writeln('          ROV_activeXDetect = False');
     document.writeln('          ROV_activeXDetect = IsObject(CreateObject(activeXname))');
     document.writeln('          If (err) then');
     document.writeln('               ROV_activeXDetect = False');
     document.writeln('          End If');
     document.writeln('     Else');
     document.writeln('          ROV_activeXDetect = False');
     document.writeln('     End If');
     document.writeln('End Function');

     document.writeln('Function ROV_activeXVersion(activeXname)');
     document.writeln('     version = 0');
     document.writeln('     on error resume next');
     document.writeln('     For i = 2 to 9');
     document.writeln('          If Not(IsObject(CreateObject(activeXname & "." & i))) then');
     document.writeln('');
     document.writeln('          else');
     document.writeln('               version = i');
     document.writeln('          End If');
     document.writeln('     Next');
     document.writeln('     ROV_activeXVersion = version');
     document.writeln('End Function');

     document.writeln('</'+'SCRIPT>');

}

function ROV_pluginDetect(plugindescription, pluginxtension, pluginmime, activeXname)
{

     var i,plugin_undetectable=0,detected=0, daPlugin=new Object();

     if (ROV_msie_windows && ROV_detect_through_vb)
     {
          plugin_undetectable = 0;
     } 
     else
     {
          plugin_undetectable = 1;
     }

     if(navigator.plugins) 
     {
          numPlugins = navigator.plugins.length;
          if (numPlugins > 1) 
          {
               if (navigator.mimeTypes && navigator.mimeTypes[pluginmime] && navigator.mimeTypes[pluginmime].enabledPlugin && (navigator.mimeTypes[pluginmime].suffixes.indexOf(pluginxtension) != -1)) 
               { 
                    if ((navigator.appName == 'Netscape') && (navigator.appVersion.indexOf('4.0') != -1)) 
                    { 
                         for(i in navigator.plugins) 
                         {
                              if ((navigator.plugins[i].description.indexOf(plugindescription) != -1) || (i.indexOf(plugindescription) != -1)) 
                              { 
                                   detected=1;
                                   ROV_pluginVersion  = navigator.plugins[i].description.charAt(navigator.plugins[i].description.description.indexOf('.')-1);
                                   break;
                              }
                         }
                    } 
                    else 
                    {
                         for (i = 0; i < numPlugins; i++) 
                         {
                              daPlugin = navigator.plugins[i];
                              if ((daPlugin.description.indexOf(plugindescription) != -1) || (daPlugin.name.indexOf(plugindescription) != -1)) 
                              {
                                   detected=1;
                                   ROV_pluginVersion  = daPlugin.description.charAt(daPlugin.description.indexOf('.')-1);
                                   break;
                              }
                         }
                    }

                    if (navigator.mimeTypes[pluginmime] == null) 
                    {
                         detected = 0;
                         version = 0;
                    }
               }

               return detected;
          } 

          else if((ROV_msie_windows == 1) && !plugin_undetectable)
          {
               detected = ROV_activeXDetect(activeXname);
               if(detected)
               {
                    ROV_pluginVersion = ROV_activeXVersion(activeXname);

               }
               return detected;
          } 
          else
          {         
               return 0;
          }
     } 
     else
     {
          return 0;
     }
}

function ROV_Reset()
{
	var ROV_hrefReturn = document.location.href.toString();
	parent.location = 'http://manager.rovion.com/Reset.aspx?VisitorID=' + ROV_VisitorID.toString() + '&VisitID=' + ROV_VisitID.toString() + '&ReturnPage=' + escape(ROV_hrefReturn);
}

// Cookie Stuff

// Check for VisitorID

var ROV_Visitor_Cookie = ROV_getCookie("ROV_Visitor");
if(!ROV_Visitor_Cookie)
{
	var ROV_now = new Date();
	ROV_fixDate(ROV_now);
	ROV_now.setTime(ROV_now.getTime() + (365 * 24 * 60 * 60 * 1000));
	ROV_setCookie("ROV_Visitor", ROV_VisitorID, ROV_now);
}
else
{
	ROV_VisitorID = ROV_getCookie("ROV_Visitor");
}

var ROV_Blocked = 0;

// Disable Presentation
var ROV_Blocked_Cookie = ROV_getCookie("ROV_Blocked");
if(!ROV_Blocked_Cookie)
{
	var ROV_now_2 = new Date();
	ROV_fixDate(ROV_now_2);
	ROV_now_2.setTime(ROV_now_2.getTime() + (365 * 24 * 60 * 60 * 1000));
	ROV_setCookie("ROV_Blocked", 0, ROV_now_2);
}
else
{
	ROV_Blocked = ROV_getCookie("ROV_Blocked");
}

function ROV_Block()
{
	var ROV_now_3 = new Date();
	ROV_fixDate(ROV_now_3);
	ROV_now_3.setTime(ROV_now_3.getTime() + (365 * 24 * 60 * 60 * 1000));
	ROV_setCookie("ROV_Blocked", 1, ROV_now_3);

	alert('Rovion BlueStream Direct is now blocked on this site');
}

function ROV_Unblock()
{
	var ROV_now_4 = new Date();
	ROV_fixDate(ROV_now_4);
	ROV_now_4.setTime(ROV_now_4.getTime() + (365 * 24 * 60 * 60 * 1000));
	ROV_setCookie("ROV_Blocked", 0, ROV_now_4);

	alert('Rovion BlueStream Direct is enabled on this site');
}

var flashDetector = function() {	
	var UNDEF = "undefined",
		OBJECT = "object",
		SHOCKWAVE_FLASH = "Shockwave Flash",
		SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
		FLASH_MIME_TYPE = "application/x-shockwave-flash",
		EXPRESS_INSTALL_ID = "SWFObjectExprInst",
		win = window,
		doc = document,
		nav = navigator;

	var ua = function() {
		var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
			playerVersion = [0,0,0],
			d = null;
		if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
			d = nav.plugins[SHOCKWAVE_FLASH].description;
			if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
				d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
				playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
				playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			}
		}
		else if (typeof win.ActiveXObject != UNDEF) {
			var a = null, fp6Crash = false;
			try {
				a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
			}
			catch(e) {
				try { 
					a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
					playerVersion = [6,0,21];
					a.AllowScriptAccess = "always";	 // Introduced in fp6.0.47
				}
				catch(e) {
					if (playerVersion[0] == 6) {
						fp6Crash = true;
					}
				}
				if (!fp6Crash) {
					try {
						a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
					}
					catch(e) {}
				}
			}
			if (!fp6Crash && a) { // a will return null when ActiveX is disabled
				try {
					d = a.GetVariable("$version");	// Will crash fp6.0.21/23/29
					if (d) {
						d = d.split(" ")[1].split(",");
						playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
					}
				}
				catch(e) {}
			}
		}
		var u = nav.userAgent.toLowerCase(),
			p = nav.platform.toLowerCase(),
			webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
			ie = false,
			windows = p ? /win/.test(p) : /win/.test(u),
			mac = p ? /mac/.test(p) : /mac/.test(u);
		/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/
		return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
	}();

	
	/* Flash Player and SWF content version matching
	*/
	function hasPlayerVersion(rv) {
		var pv = ua.pv, v = rv.split(".");
		v[0] = parseInt(v[0], 10);
		v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
		v[2] = parseInt(v[2], 10) || 0;
		return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
	}	
	
	return {
		/* Public API
			- Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
		*/ 		
		getFlashPlayerVersion: function() {
			return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
		},
		hasFlashPlayerVersion: hasPlayerVersion		
	};
}();

var ROV_FLASH_INSTALLED = flashDetector.hasFlashPlayerVersion("10");
var ROV_FLASH = flashDetector.getFlashPlayerVersion().major;
ROV_detection_string = ROV_detection_string  + "&FLASH=" + ROV_FLASH.toString();
var ROV_presentation_script = document.createElement('script');
ROV_presentation_script.language = 'javascript1.2';
ROV_presentation_script.type = 'text/javascript';
ROV_presentation_script.src = 'http://manager.rovion.com/PresentationHandler.ashx?VisitID=1096950926&VisitorID=' + ROV_VisitorID + '&UnitID=0&Instance=1&BLOCKED=' + ROV_Blocked + ROV_detection_string + '&HREF=' + ROV_HREF_Encoded;
ROV_head.appendChild(ROV_presentation_script);