function makeSWF(u,w,h,a) {
	var c = '';
	if(navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
		for(var i in a) c += (c!=''?' ':'')+i+'='+a[i];
		return '<embed src="'+u+'" type="application/x-shockwave-flash" '+c+' width="'+w+'" height="'+h+'"></embed>';
	} else {
		a['movie'] = u;
		for(var i in a) c +='<param name="'+i+'" value="'+a[i]+'" />';
		return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+w+'" height="'+h+'">'+c+'</object>';
	}
}

function regch(e,exp) {
	e.previousSibling.style.color = e.value.match(exp) ? 'green' : 'red';
}

function allch(e) {
	labels = e.getElementsByTagName('label');
	for(i in labels) {
		if(labels[i].style.color!='green') {
			alert('Please fill out the "'+labels[i].innerHTML+'" field.');
			labels[i].focus();
			return false
		}
	}
	return true;
}

function replaceWithFlash(e) {
	e.parentNode.innerHTML=makeSWF('http://www.airq-ca.com/player-viral.swf', this.width, this.height, { flashvars: 'file=' + e.src });
}

function makePlayer(w, h, urls){
	var r;
	r = '<video width="'+w+'" height="'+h+'" controls>';
	for (type in urls) r += '<source src="'+urls[type]+'" type="video/'+type+'" />';
	r += '<!--[if IE]><OBJECT id="VIDEO" width="'+w+'" height="'+h+'" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject"><PARAM NAME="URL" VALUE="'+urls['mp4']+'"><PARAM NAME="AutoStart" VALUE="False"></OBJECT><div style="display:none"><![endif]-->';
	r += '<p style="color:red;display:block;width:'+w+'px;height:'+h+'px">You must have an HTML5 capable browser to watch the video, we recommend <a href="http://www.google.com/chrome/?hl=en">Google Chrome</a>.</p>';
	r += '<!--[if IE]></div><![endif]-->';
	r += '</video>';
	return r;
}

var _gaq = [
	['_setAccount', 'UA-13209734-3'],
	['_setDomainName', 'none'],
	['_setAllowLinker', true],
	['_trackPageview'],
	['_setAccount', 'UA-13209734-2'],
	['_setDomainName', 'none'],
	['_setAllowLinker', true],
	['_trackPageview']
];

var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = 'http://www.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);

