d = document;
n = navigator;
w = window;

//Flash

var agt = n.userAgent.toLowerCase();
var ie  = (agt.indexOf("msie") != -1);
var ns  = (n.appName.indexOf("Netscape") != -1);
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);

if (ie && win) pluginlist = detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash");
if (ns || !win) {
		nse = "";

		for (var i = 0; i < n.mimeTypes.length; i++) nse += navigator.mimeTypes[i].type.toLowerCase();

		pluginlist = detectNS("application/x-shockwave-flash","Shockwave Flash");
}

function detectIE (ClassID, name){
	result = false;

	document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n');

	if (result) return name + ',';
	else return '';
}

function detectNS (ClassID, name){
	nn = "";

	if (nse.indexOf(ClassID) != -1) if (n.mimeTypes[ClassID].enabledPlugin != null) nn = name + ",";

	return nn;
}

pluginlist += n.javaEnabled() ? "Java," : "";

if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);






thisProtocol = (location.href.toLowerCase().substr(0,5) == 'https') ? 'https' : 'http';
loadLater = [];

function activateControls(codebase, objectId, width, height, movie, loop, menu, quality, wMode){
	if (pluginlist.indexOf('Flash') != -1){
		buildHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + thisProtocol + '://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + codebase + '" height="' + height + '" id="' + objectId + '" width="' + width + '">';
		buildHTML += '<param name="movie" value="' + movie + '" />';
		buildHTML += '<param name="loop" value="' + loop + '" />';
		buildHTML += '<param name="menu" value="' + menu + '" />';
		buildHTML += '<param name="quality" value="' + quality + '" />';
		buildHTML += '<param name="wmode" value="' + wMode + '" />';
		buildHTML += '<param name="allowScriptAccess" value="always" />';
		buildHTML += '<embed allowscriptaccess="always" height="' + height + '" loop="' + loop + '" menu="' + menu + '" name="' + objectId + '" pluginspage="' + thisProtocol + '://www.macromedia.com/go/getflashplayer" quality="' + quality + '" src="' + movie + '" type="application/x-shockwave-flash" width="' + width + '" wmode="' + wMode + '" />';
		buildHTML += '</object>';

		d.write(buildHTML);
	} else {
		loadLater.push(objectId);
	}
}

w.onload = function(){
	if (loadLater.length > 0) d.getElementById('box3').style.backgroundImage = 'url(/images/box3.png)';

	for (i = 0; i < loadLater.length; i++){
		d.getElementById('noflash_' + loadLater[i]).style.display = 'block';
	}

	d.getElementById('body').style.display = 'block';
}




function checkLogin(){
	if (d.form.clientType[0].checked){
		d.getElementById('user').name = 'userid';
		d.getElementById('pass').name = 'userpw';
		d.form.action = 'https://customers.alchemy.net/client/session.php';
	} else if (d.form.clientType[1].checked){
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.form.user.value)){
			d.getElementById('user').name = 'username';
			d.getElementById('pass').name = 'password';
			d.form.action = 'https://billing.alchemy.net/dologin.php?goto=clientarea';
		} else {
			d.getElementById('user').name = 'contactUsername';
			d.getElementById('pass').name = 'contactPassword';
			d.form.action = 'https://billing.alchemy.net/clientarea.php?action=512&sid=';
		}
	} else return false;
}

