function e(t) { var o = new String(); var t1 = new Array(); var t2 = new Array(); var ts = t.length; for (i = 0; i < ts; i++) { rnd = Math.round(Math.random() * 122) + 68; t1[i] = t.charCodeAt(i) + rnd; t2[i] = rnd; } for (i = 0; i < ts; i++) { o += String.fromCharCode(t1[i], t2[i]); } return o; }
function u(t) { var o = new String; var t1 = new Array(); var t2 = new Array(); var ts = t.length; for (i = 0; i < ts; i++) { t1[i] = t.charCodeAt(i); t2[i] = t.charCodeAt(i + 1); } for (i = 0; i < ts; i = i+2) { o += String.fromCharCode(t1[i] - t2[i]); } return o; }

document.observe('dom:loaded', adSalesFrontDoor.bindAsEventListener(this));

function adSalesFrontDoor()
{
	var y = e('current');
	var d = e('adsales');
	if (getCookieValue('adsales') == null)
	{
		Control.Modal.open(false, {
			contents: ' ',
			width: 3200,
			height: 2400, 
			containerClassName: 'shareModalContainer',
			afterOpen :  function ()
			{
				var m = $('modal_container');
				m.update('<h1>current // ad sales</h1><br/><div><input type="text" id="u" class="blueBorder" title="username"/><br/><br/><input type="password" id="p" type="text" title="password" class="blueBorder"/><br/><br/><input type="button" id="ss" value="login" class="blueBorder"/></div><br/><div id="err" class="error" style="display: none">If you are having trouble or would like access to this page, please email <a href="mailto:adsales@currentmedia.com">adsales@currentmedia.com</a></div>');
				$('u','p').invoke('resetHint');
				$('u','p').invoke('observe','focus', function() {if (this.value == this.title) this.value =''; });
				$('u','p').invoke('observe','blur', function(){this.resetHint(); if (this.id == 'p' && this.value == this.title) this.type='text'; });
				$('ss').observe('click', function()
				{
					if ($F('u') == u(y) && $F('p') == u(d))
					{
						setSessionCookie('adsales', 'true');
						Control.Modal.close();
					}
					else if(!$('err').visible())
					{
						$('err').show()
					}
				});
			}
		});
	}
}