function popClientLogin(){
	window.open('https://secure.websitealive.com/apps/login/login_pop.asp?username=&loginas=operator&checkbox_adminrights=false','pop','width=600,height=500');	
}

function chatjs(){

/*
	if (document.getElementById('wsa_embed').innerHTML != '' && document.getElementById('wsa_loginquestion')){
		//chat window present;
		document.location.href='#wsa_embed';
		document.getElementById('wsa_loginquestion').focus();
		document.getElementById('wsa_loginquestion').innerHTML = '';
	}else{
		//wsa_open_chat('0','0');	
	}
	*/
	//pop up to show customers we have this capability.
	window.open('http://www.websitealive3.com/9/rRouter.asp?groupid=9&websiteid=10&departmentid=5751&dl='+escape(document.location.href),'','width=200,height=200');
	
	//window.open('http://a0.websitealive.com/9/rRouter.asp?groupid=9&websiteid=10&departmentid=5751&dl='+escape(document.location.href),'','width=200,height=200');

}

function launch_embeddedx(){
	//** MANDATORY: Please fill in information based on your account.
	var wsa_serverurl 		= 'https://a0.websitealive.com';
	var wsa_groupid 		= '9';
	var wsa_departmentid 	= '5751';
	var wsa_websiteid 		= '77';
	var wsa_loginname 		= 'Visitor';
	var wsa_loginquestion	= document.getElementById('wsa_loginquestion').value;
	
	wsa_open_chat('0','0');
}

function launch_embedded(){
	//** MANDATORY: Please fill in information based on your account.
	var wsa_serverurl 		= 'https://www.websitealive3.com';
	var wsa_groupid 		= '9';
	var wsa_departmentid 	= '5751';
	var wsa_websiteid 		= '77';
	var wsa_loginname 		= 'Visitor';
	var wsa_loginquestion	= document.getElementById('wsa_loginquestion').value;
	
	wsa_open_chat('0','0');
}



function wsa_include_jsx(){
	var wsa_host = (("https:" == document.location.protocol) ? "https://" : "http://");
	var js = document.createElement('script');
	js.setAttribute('language', 'javascript');
	js.setAttribute('type', 'text/javascript');
	js.setAttribute('src',wsa_host + 'a0.websitealive.com/9/Visitor/vTracker_v2.asp?websiteid=77&groupid=9');
	document.getElementsByTagName('head').item(0).appendChild(js);
}

function wsa_include_js(){
	var wsa_host = (("https:" == document.location.protocol) ? "https://" : "http://");
	var js = document.createElement('script');
	js.setAttribute('language', 'javascript');
	js.setAttribute('type', 'text/javascript');
	js.setAttribute('src',wsa_host + 'www.websitealive3.com/9/Visitor/vTracker_v2.asp?websiteid=77&groupid=9');
	document.getElementsByTagName('head').item(0).appendChild(js);
}







if (window.attachEvent) {window.attachEvent('onload', wsa_include_js);}
else if (window.addEventListener) {window.addEventListener('load', wsa_include_js, false);}
else {document.addEventListener('load', wsa_include_js, false);}



/* crazyegg tracking code from suhshi */
setTimeout(function(){var a=document.createElement("script");
var b=document.getElementsByTagName('script')[0];
a.src=document.location.protocol+"//dnn506yrbagrg.cloudfront.net/pages/scripts/0011/9264.js?"+Math.floor(new Date().getTime()/3600000);
a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);
/*     */





/*Jody's Tracking Code*/

// Function to include jQuery
function include(filename)
{
    var head = document.getElementsByTagName('head')[0];
   
    script = document.createElement('script');
    script.src = filename;
    script.type = 'text/javascript';
   
    head.appendChild(script);
}

if (!jQuery)
{
	include('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
}

// Google Analytics tracking snippet
var _gaq = _gaq || [];

//jody
_gaq.push(['_setAccount', 'UA-17653566-38']);
_gaq.push(['_trackPageview']);

//wsa
_gaq.push(['_setAccount', 'UA-425476-1']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

// Phone tracking
function getParameterByName(name)
{
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
        return "";
    else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
}

function setCookie(key, value)
{
    var expires = new Date();
    expires.setTime(expires.getTime() + 31536000000); //1 year
    document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
}

function getCookie(key)
{
    var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
    return keyValue ? keyValue[2] : null;
}

phone = null;
phone_query = getParameterByName('utm_phone');
phone_cookie = getCookie('utm_phone');
// Found phone number
if (phone_query != "" || phone_cookie)
{
    if (phone_query != "")
    {
        setCookie('utm_phone', phone_query);
        phone = phone_query;
    }
    else if (phone_cookie)
    {
        phone = phone_cookie;
    }
}



