///////////////////////////////////////////////////scripts national-aircheck/////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function XHConn()
{
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.connect = function(sURL, sMethod, sVars, fnDone)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET")
      {
		if (xmlhttp.overrideMimeType) {
			xmlhttp.overrideMimeType('text/xml');
		}
		else {
			xmlhttp.setHeader("Content-type: text/xml");
			xmlhttp.setHeader("Cache-Control","no-cache"); //HTTP 1.1
			xmlhttp.setHeader("Pragma","no-cache"); //HTTP 1.0
			xmlhttp.setDateHeader ("Expires", 0); //prevents caching at the proxy server
		}
        xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp);
        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}
function checkTime(t) {
	if (t<10) {
		t = '0'+t;
	}
	return t;
}
function clock() {
	var today=new Date();
	var h=today.getHours();
	var m=today.getMinutes();
	var s=today.getSeconds();
	var d = today.getDate();
	var mn = today.getMonth();
	var y = today.getFullYear();
	d=checkTime(d);
	m=checkTime(m);
	s=checkTime(s);
	if (h<12 && h>0)
		x='am';
	else if (h==0) {
		x='am';
		h=12;
		}
	else {
		x='pm';
		h -= 12;
		}
	switch (mn) {
		case 0:
			mn = 'January';
			break;
		case 1:
			mn = 'February';
			break;
		case 2:
			mn = 'March';
			break;
		case 3:
			mn = 'April';
			break;
		case 4:
			mn = 'May';
			break;
		case 5:
			mn = 'June';
			break;
		case 6:
			mn = 'July';
			break;
		case 7:
			mn = 'August';
			break;
		case 8:
			mn = 'September';
			break;
		case 9:
			mn = 'October';
			break;
		case 10:
			mn = 'November';
			break;
		case 11:
			mn = 'December';
			break;
			}
	document.getElementById('dtg').innerHTML=d+" "+mn+" "+y+", "+h+":"+m+" "+x;
	ttimer = setTimeout("playsong()",1000);
}
var ttimer = null;
function playsong() {
	if (ttimer) {
		clearTimeout(ttimer);
	}
	var h = window.location.pathname.substring(location.pathname.lastIndexOf('/')+1);
	h = h.substring(0,h.length-5);
	switch (h) {
		case 'as':
//			soundManager.play('raitt');
		break;
		case 'bert':
//			soundManager.play('money');
		break;
		case 'nt2500':
//			soundManager.play('summer');
		break;
		case 'rks':
//			soundManager.play('hear');
		break;
		case 'rst':
//			soundManager.play('costello');
		break;
	}
}
function emailcloak() {
	var emla = "aircheck";
	var emlb = "@";
	var emlc = "national-aircheck.com";
	var eml = emla + emlb + emlc;
	var msg = "<span class=\"addy_where\"></span> " + eml + "";
	var out = "<span class=\"cont_label\">Email</span>: <a href=\"mailto:" + eml + "\">" + msg + "</a>";
	document.getElementById('eaddy').innerHTML = out;
	}
var client = function() {
	var c = this;
	this.curid = null;
	this.txttimer = null;
	this.fadetimer = null;
	this.o = 1;
	this.clbox = document.getElementById('c_box');
	this.ca = new Array();
	this.initclient = function() {
		c.ca[0]="Fleishman Hillard|Brian Blazer|I love the fact that I can actually reach them 24/7. Excellent customer service from beginning to end";
		c.ca[1]="J. Walter Thompson|Dexter Myers|Their networks are amazing. They do projects other monitoring firms wouldn't even attempt";
		c.ca[2]="Hunter PR|Caryn Browning|We have been using National Aircheck for years. When they say any station, anywhere, anytime, they mean it.";
		c.ca[3]="Edelman PR|Patrick Skertich|For years, there was no way for us to efficiently track our satellite media tours in smaller markets. National Aircheck made it easy for us to do that";
		c.ca[4]="DCI Group|Samantha Succop|Whether it's a radio or tv clip or a transcript, the National Aircheck is fast, efficient and priced right.";
		c.ca[5]="Roadhouse Public Relations|Wade Garrett|They have really cool parties!";
		c.ca[6]="Sales Manager, National Aircheck|Mary Ann Halvorson|You can dance like nobody is watching, but rest assured I'll be there pointing and laughing";
                c.ca[7]="Chief Technical Officer, National Aircheck|Jim Dage|Like uh, what's this button do?";
                c.ca[8]="Chief Technical Officer, National Aircheck|Jim Dage|Like uh, what's this button do?";

		c.curid = 0;
		
		c.changetxt();
	}
	this.fadeout = function() {
		//opacity = 100 or 1
		if (c.txttimer) {
			clearTimeout(c.txttimer);
		}
		if (c.o>0) {
			c.o = c.o - 0.2;
			c.clbox.style.opacity = self.o;
			c.clbox.style.MozOpacity = self.o;
			c.clbox.style.KhtmlOpacity = self.o;
			c.clbox.style.filter = "alpha(opacity=" + (c.o*100) + ")";
			c.fadetimer = setTimeout("this.fadeout()",50);
		}
		else {
			if (c.fadetimer) {
				clearTimeout(c.fadetimer);
			}
			c.changetxt();
			c.txttimer = setTimeout("this.fadein()",500);
		}
	}
	this.fadein = function() {
		//opacity = 0;
		if (c.txttimer) {
			clearTimeout(c.txttimer);
		}
		if (c.o<1) {
			c.o = self.o + 0.2;
			c.clbox.style.opacity = self.o;
			c.clbox.style.MozOpacity = self.o;
			c.clbox.style.KhtmlOpacity = self.o;
			c.clbox.style.filter = "alpha(opacity=" + (c.o*100) + ")";
			c.fadetimer = setTimeout("this.fadein()",50);
		}
		else {
			if (c.fadetimer) {
				clearTimeout(c.fadetimer);
			}
		}
	}
	this.changetxt = function() {
		var next = ( Math.round( ( Math.random()*( c.ca.length-1 ) ) ) );
		if (next == c.curid)
		{
			if (next == c.ca.length-1) {
				next = 0;
			}
			else {
				next = next + 1;
			}
		}
		var temp = c.ca[next].split('|');
		var quote = temp[2];
		var person = temp[1];
		var company = temp[0];
		var str = '<div id="cq">'+quote+'</div>';
		str += '<div id="cp">'+person+'</div>';
		str += '<div id="cc">'+company+'</div>';
		c.clbox.innerHTML = str;
		c.curid = next;
		
		c.txttimer = setTimeout("this.fadeout()",7000);
	}
	c.initclient();
}
window.onload=clock;
