document.write("<script type='text/javascript' src='/inc/js/custom/partner/apollo/phoenix_edu/cmEluminate.js'></script><script type='text/javascript' src='/inc/js/custom/partner/apollo/phoenix_edu/cmdatagutils.js'></script>");
document.write("<link rel='icon' href='https://www.phoenix.edu/favicon.ico' type='image/x-icon'><link rel='shortcut icon' href='https://www.phoenix.edu/favicon.ico' type='image/x-icon'>");

var agt=navigator.userAgent.toLowerCase();
if ((agt.indexOf("msie 7.")==-1) && (agt.indexOf("msie") !=-1))
{
	
	function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
	{
		 var arVersion = navigator.appVersion.split("MSIE")
		 var version = parseFloat(arVersion[1])
		 if ((version >= 5.5) && (document.body.filters))
		 {
				for(var i=0; i<document.images.length; i++)
				{
					 var img = document.images[i]
					 var imgName = img.src.toUpperCase()
					 if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
					 {
							var imgID = (img.id) ? "id=\'" + img.id + "\' " : ""
							var imgClass = (img.className) ? "class=\'" + img.className + "\' " : ""
							var imgTitle = (img.title) ? "title=\'" + img.title + "\' " : "title=\'" + img.alt + "\' "
							var imgStyle = "display:inline-block;" + img.style.cssText
							if (img.align == "left") imgStyle = "float:left;" + imgStyle
							if (img.align == "right") imgStyle = "float:right;" + imgStyle
							if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
							var strNewHTML = "<span " + imgID + imgClass + imgTitle
							+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
							+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
							+ "(src=\'" + img.src + "\', sizingMethod=\'scale\');\"></span>"
							img.outerHTML = strNewHTML
							i = i-1
					 }
				}
		 }
	}
	window.attachEvent("onload", correctPNG);
}

function getValue(param)
{
	for (var i = 0; i < document.frmOffers.length; i++)
	{
		if (document.frmOffers[i].name == param)
		{
			return document.frmOffers[i].value
			break;
		}
	}
	return variable = "";
}

function hov(loc,cls)
{
	 if(loc.className)
			loc.className=cls;
}

thatTZ = new Date

function showTheTime()	{
	dateStr = thatTZ.toGMTString()
	dateStr = dateStr.substr(0,dateStr.length - 3)
	thatTZ.setTime(Date.parse(dateStr))
	thatTZ.setHours(thatTZ.getHours() + -7)
	return thatTZ.getHours()
}

var campaignID="",psrc="",channel="",category="",creative_id="",vrefid="",v1="",v2="",v3="",v4="",v5="",v6="",v7="",v8="",unit="",provider="",initiative="",mktg_prog="",version="",classification="",destination="",distribution="",user1="",user2="",user3="",user4="",user5="",fn="",orderID="",email_address="",city="",state="",postal_code="",country="",level_education="",vContentCategoryID="",vConversionCategory="",vConversionEvent="",vPageView="",clphone="",arrDynContent=new Array(),cm_FormPageID=true;

// script to attach targeting params to phoenix.edu links
function goTo(loc) {
var ffs = document.frmOffers;
var url = loc;
var urlparams = ((loc.indexOf('?') !== -1) ? "" : "?");
for(i=0;i<ffs.length;i++) {
	if(ffs[i].type === 'hidden') {
		if(ffs[i].id.indexOf('|OPTIONAL') !== -1) {
			if(ffs[i].value !== "") {
				var nm = ffs[i].name;
				var nmabbrv = nm.substring(0,(nm.indexOf('|')));
				var vl = ffs[i].value;
				if(nmabbrv !== 'pvp_design' && nmabbrv !== 'v2') {
					urlparams += "&" + nmabbrv + "=" + vl;
				}
				else if(nmabbrv === 'v2') { v2 = vl; }
			}
		}
	}
}
urlparams += "&v6=" + v2 + "&v7=" + v7 + "&pvp_campaign=" + campaignID + "&psrc=" + psrc + "&clphone=" + clphone;
url += urlparams;
window.location = url;
}

function doAutoSubmit(thisAsField) {
	var asFieldObj = document.getElementById(thisAsField);
	if ( ( ( asFieldObj.type == "text" || asFieldObj.type == "textarea" || asFieldObj.type == "password" ) && asFieldObj.value != "" ) ||
	( asFieldObj.type.toString().charAt(0) == "s" && asFieldObj.selectedIndex > 0 ) ||
	( asFieldObj.type.toString().charAt(0) == "r" && isCheckedRadio( document.frmOffers, asFieldObj ) == "Y" ) ||
	( asFieldObj.type.toString().charAt(0) == "c" && isCheckedCheckbox( document.frmOffers, asFieldObj, 1 ) == "Y" ))
	{
		doSubmit(true);
	}
}

function setEvent( thisId ) {
	for ( var x = 0; x < document.frmOffers.length; x++ ) {
		var thisObj = document.frmOffers.elements[x];
		if ( thisObj.id == thisId ) {
			if ( thisObj.type == "checkbox" || thisObj.type == "radio" ) thisObj.onclick = function(){doAutoSubmit(thisId)}
			else if ( thisObj.type.toString().charAt(0) == "s" ) {
				if ( thisObj != form.area_interest && thisObj.value != "-X-" ) {
					thisObj.selectedIndex = 0;
				}
				thisObj.onchange = function(){doAutoSubmit(thisId)}
			}
			else
				thisObj.onblur = function(){doAutoSubmit(thisId)}
			}
		}
	}

function previousStep() {
	curDisplayGroup = curDisplayGroup - 1;
	var stepObj = document.getElementById("DISPLAYGROUP" + (curDisplayGroup));
	showObj(stepObj.previousSibling,true);
	showObj(stepObj,false);
	updateStatusBar(curDisplayGroup - 1);
}

function reWriteAddress(frmIndex) {
	var locationStr = getValue('city')+', '+getValue('state')+' '+getValue('postal_code')+' ';// Puts string together of city state and zip
	var parentRow = document.frmOffers[frmIndex].parentNode; // returns the address <tr> holder
	var newDiv = document.createElement('span');

	newDiv.appendChild(document.createTextNode(locationStr));
	newDiv.className ='frmAddressHint';//sets div classname
	newDiv.id ='frmAddressHint';//sets div id
	parentRow.appendChild(newDiv);
	newDiv.align ='left';//aligns left
}
	
/* ------------------ State and Zip Hints ------------------------*/

function addHint(element, text, cName) {//accepts element and postion, and classname, and true or false for highlight background
  //check if hint already exists, and replace hint
  if(element.nextSibling && element.nextSibling.className == cName){
    element.parentNode.removeChild(element.nextSibling);
    if(highlight == true) highlight = false;
  }
  var x = document.createElement('span');
  x.appendChild(document.createTextNode(text));
  if(cName) x.className = cName;
  else  x.className = 'hint';
  element.parentNode.appendChild(x);
}

function removeHint(element, cName) {//accepts element
  //check if hint already exists, and replace hint
  if(element.nextSibling && element.nextSibling.className == cName){
    element.parentNode.removeChild(element.nextSibling);
  }
}

function addEvent(obj,evt,fn) {
	if (document.addEventListener) {
		addEvent = function (obj,evt,fn) {
			obj.addEventListener(evt,fn,false);
		}
	}
	else if (document.attachEvent) {
		addEvent = function (obj,evt,fn) {
			obj.attachEvent('on'+evt,fn);
		}
	}
	addEvent(obj,evt,fn);
}

function loadClickToChat(){
	var href = window.location.href;
	var chatURL = 'https://'+href.slice(href.indexOf(v1),href.indexOf('.edu')+4)+'/chat/chatContainer.jsp?uri=/';
	var parameters = [
		'clphone',
		'pvp_campaign',
		'pvp_campaign_int',
		'channel',
		'creative_id',
		'creative_desc',
		'keyword',
		'placement',
		'category',
		'psrc',
		'psrc_url',
		'vrefid',
		'v1',
		'v2',
		'v3',
		'v4',
		'v5',
		'v6',
		'v7',
		'v8',
		'area_interest',
		'tracking',
		'source',
		'detail',
		'cluserid',
		'referring_domain',
		//'referring_url',
		'referring_engine',
		'mvtkey',
		'unit',
		'provider',
		'initiative', 
		'mktg_prog',
		'version',
		'classification',
		'destination',
		'distribution',
		'user1',
		'user2',
		'user3',
		'user4',
		'user5'
	]
	var chatParameters = '';
	for(var x=0;x<parameters.length;x++){
		var pVal = getValue(parameters[x]);
		if(pVal != ""){
			/*if(chatParameters.length == 0) chatParameters += '?';
			else chatParameters += '&';*/
			chatParameters += '&'+parameters[x]+'='+encodeURI(pVal);
		}
	}
	if(getValue('POID') != '') chatParameters += ('&poid='+getValue('POID'));
	if(getValue('pvp_campaign_int') == '')chatParameters += '&pvp_campaign_int=26338_8667_9_95';
	window.location.href = chatURL+chatParameters;
	//window.open(chatURL+chatParameters);
}

// Google Anaylytics
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

// DoubleClick
var axel = Math.random()+"";
var a = axel * 10000000000000;
