
var sessionid_0d5c3faf = "1d8d53140081ac67882d0fe3d6042f6d";
var country_0d5c3faf = "United States";
var countrycode_0d5c3faf = "us";
var hasnotes_0d5c3faf = "";
var campaignid_0d5c3faf = "";
var campaigntitle_0d5c3faf ="";
var isfirsttime_0d5c3faf = 1;
var timer_0d5c3faf = 0;
var imagefetch_0d5c3faf = 9;
var updateurl_0d5c3faf = "";
var screenHeight = window.screen.availHeight;
var screenWidth = window.screen.availWidth;
var colorDepth = window.screen.colorDepth;
var timeNow = new Date();
var referrer = escape(document.referrer);
var windows, mac, linux;
var ie, op, moz, misc, browsercode, browsername, browserversion, operatingsys;
var dom, ienew, ie4, ie5, ie6, moz_rv, moz_rv_sub, ie5mac, ie5xwin, opnu, op4, op5, op6, op7, saf, konq;
var appName, appVersion, userAgent;
var appname = navigator.appName;
var appVersion = navigator.appVersion;
var userAgent = navigator.userAgent;
var dombrowser = "default";
var isChatRunning_0d5c3faf = 0;
var title = document.title;
var proactiveImageUse_0d5c3faf = new Image();
var adsJunptimes_0d5c3faf = 0;
var campaignTitle = "";
campaignTitle ="";
var adsContent = "";
var adsIsLoad = 0;
windows = (appVersion.indexOf('Win') != -1);
mac = (appVersion.indexOf('Mac') != -1);
linux = (appVersion.indexOf('Linux') != -1);
if (!document.layers) {
	dom = (document.getElementById ) ? document.getElementById : false;
} else {
	dom = false;
}
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
winH = myHeight;
winW = myWidth;
misc=(appVersion.substring(0,1) < 4);
op=(userAgent.indexOf('Opera') != -1);
moz=(userAgent.indexOf('Gecko') != -1);
ie=(document.all && !op);
saf=(userAgent.indexOf('Safari') != -1);
konq=(userAgent.indexOf('Konqueror') != -1);

if (op) {
	op_pos = userAgent.indexOf('Opera');
	opnu = userAgent.substr((op_pos+6),4);
	op5 = (opnu.substring(0,1) == 5);
	op6 = (opnu.substring(0,1) == 6);
	op7 = (opnu.substring(0,1) == 7);
} else if (moz){
	rv_pos = userAgent.indexOf('rv');
	moz_rv = userAgent.substr((rv_pos+3),3);
	moz_rv_sub = userAgent.substr((rv_pos+7),1);
	if (moz_rv_sub == ' ' || isNaN(moz_rv_sub)) {
		moz_rv_sub='';
	}
	moz_rv = moz_rv + moz_rv_sub;
} else if (ie){
	ie_pos = userAgent.indexOf('MSIE');
	ienu = userAgent.substr((ie_pos+5),3);
	ie4 = (!dom);
	ie5 = (ienu.substring(0,1) == 5);
	ie6 = (ienu.substring(0,1) == 6);
	ie7 = (ienu.substring(0,1) == 7);
}

if (konq) {
	browsercode = "KO";
	browserversion = appVersion;
	browsername = "Konqueror";
} else if (saf) {
	browsercode = "SF";
	browserversion = appVersion;
	browsername = "Safari";
} else if (op) {
	browsercode = "OP";
	if (op5) {
		browserversion = "5";
	} else if (op6) {
		browserversion = "6";
	} else if (op7) {
		browserversion = "7";
	} else {
		browserversion = appVersion;
	}
	browsername = "Opera";
} else if (moz) {
	browsercode = "MO";
	browserversion = appVersion;
	browsername = "Mozilla";
} else if (ie) {
	browsercode = "IE";
	if (ie4) {
		browserversion = "4";
	} else if (ie5) {
		browserversion = "5";
	} else if (ie6) {
		browserversion = "6";
	} else if (ie7) {
		browserversion = "7";	
	} else {
		browserversion = appVersion;
	}
	browsername = "Internet Explorer";
}

if (windows) {
	operatingsys = "Windows";
} else if (linux) {
	operatingsys = "Linux";
} else if (mac) {
	operatingsys = "Mac";
} else {
	operatingsys = "Unkown";
}

if (document.getElementById)
{
	dombrowser = "default";
} else if (document.layers) {
	dombrowser = "NS4";
} else if (document.all) {
	dombrowser = "IE4";
}

function browserObject_0d5c3faf(objid)
{
	if (dombrowser == "default")
	{
		return document.getElementById(objid);
	} else if (dombrowser == "NS4") {
		return document.layers[objid];
	} else if (dombrowser == "IE4") {
		return document.all[objid];
	}
}

function doRand_0d5c3faf()
{
	var num;
	now=new Date();
	num=(now.getSeconds());
	num=num+1;
	return num;
}

function getCookie_0d5c3faf(name) {
	var crumb = document.cookie;
	var index = crumb.indexOf(name + "=");
	if (index == -1) return null;
	index = crumb.indexOf("=", index) + 1;
	var endstr = crumb.indexOf(";", index);
	if (endstr == -1) endstr = crumb.length;
	return unescape(crumb.substring(index, endstr));
}

function deleteCookie_0d5c3faf(name) {
	var expiry = new Date();
	document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}

function elapsedTime_0d5c3faf()
{
	if (timer_0d5c3faf < 3600)
	{
		timer_0d5c3faf++;
		imagefetch_0d5c3faf++;

		if (imagefetch_0d5c3faf > 10) {
			imagefetch_0d5c3faf = 0;
			doStatusLoop_0d5c3faf();
		}

		setTimeout("elapsedTime_0d5c3faf();", 1000);
	}
}

function doStatusLoop_0d5c3faf() {
	date1 = new Date();
	updateurl_0d5c3faf = "http://esupport.ready-online.com/visitor/index.php?_m=livesupport&_a=updatefootprint&time="+date1.getTime()+"&rand="+doRand_0d5c3faf()+"&url="+encodeURIComponent(window.location)+"&isfirsttime="+encodeURIComponent(isfirsttime_0d5c3faf)+"&sessionid="+encodeURIComponent(sessionid_0d5c3faf)+"&referrer="+encodeURIComponent(document.referrer)+"&resolution="+encodeURIComponent(screenWidth+"x"+screenHeight)+"&colordepth="+encodeURIComponent(colorDepth)+"&platform="+encodeURIComponent(navigator.platform)+"&appversion="+encodeURIComponent(navigator.appVersion)+"&appname="+encodeURIComponent(navigator.appName)+"&browsercode="+encodeURIComponent(browsercode)+"&browserversion="+encodeURIComponent(browserversion)+"&browsername="+encodeURIComponent(browsername)+"&operatingsys="+encodeURIComponent(operatingsys)+"&pagetitle="+encodeURIComponent(title)+"&country="+encodeURIComponent(country_0d5c3faf)+"&countrycode="+encodeURIComponent(countrycode_0d5c3faf)+"&hasnotes="+encodeURIComponent(hasnotes_0d5c3faf)+"&campaignid="+encodeURIComponent(campaignid_0d5c3faf)+"&campaigntitle="+encodeURIComponent(campaigntitle_0d5c3faf);
	proactiveImageUse_0d5c3faf = new Image();
	proactiveImageUse_0d5c3faf.onload = imageLoaded_0d5c3faf;
	proactiveImageUse_0d5c3faf.src = updateurl_0d5c3faf;	
	isfirsttime_0d5c3faf = 0;
}

function startChat_0d5c3faf(proactive)
{
	isChatRunning_0d5c3faf = 1;

	docWidth = (winW-500)/2;
	docHeight = (winH-480)/2;			
	Modalbox.show('<iframe height="458" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="'+'http://esupport.ready-online.com/visitor/index.php?_m=livesupport&_a=startclientchat&sessionid='+sessionid_0d5c3faf+'&proactive='+proactive+'&departmentid=7&randno='+doRand_0d5c3faf()+'&fullname=&email='+'"></iframe>', 
	{
		width: 500, 
		title: (campaignTitle ? campaignTitle :"Need help?"), 
		overlayClose: false,
		beforeHide: closeProactiveRequest_0d5c3faf()
		});
	
}
function startChatNow_0d5c3faf(proactive)
{
	isChatRunning_0d5c3faf = 1;

	docWidth = (winW-500)/2;
	docHeight = (winH-480)/2;			
	Modalbox.show('<iframe height="458" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="'+'http://esupport.ready-online.com/visitor/index.php?_m=livesupport&_a=startformchat&sessionid='+sessionid_0d5c3faf+'&proactive='+proactive+'&departmentid=7&randno='+doRand_0d5c3faf()+'&fullname='+encodeURIComponent(campaigntitle_0d5c3faf+'-visitor')+'&email=chatNow%40ready-market.com'+'"></iframe>', 
	{
		width: 500, 
		title: (campaignTitle ? campaignTitle :"Need help?"), 
		overlayClose: false,
		beforeHide: function(){closeProactiveRequest_0d5c3faf()}
		});
	
}

function imageLoaded_0d5c3faf() {
	if (!proactiveImageUse_0d5c3faf)
	{
		return;
	}
	proactiveAction = proactiveImageUse_0d5c3faf.width;

	if (proactiveAction == 3)
	{
		doProactiveForced_0d5c3faf();
	} else if (proactiveAction == 4) {
		displayProactiveChatData_0d5c3faf();
	} else {
	}
}

function writeProactiveRequestData_0d5c3faf()
{
	docWidth = (winW-450)/2;
	docHeight = (winH-400)/2;
	classData = "DISPLAY: none; FLOAT: left; POSITION: absolute; TOP:"+docHeight+"px; LEFT:"+docWidth+"px; WIDTH: 450px; HEIGHT: 400px; Z-INDEX: 500;";
	writedata = "<style type=\"text/css\"> <!-- #proactivechatdiv { "+classData+" } --> </style>";
	writedata = "<div id=\"proactivechatdiv\" style=\""+classData+"\">";
	writedata += "<table width=\"450\" height=\"200\"  border=\"0\" cellpadding=\"1\" cellspacing=\"0\">  <tr>    <td bgcolor=\"#3894E5\"><table width=\"450\" height=\"200\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">      <tr>        <td align=\"left\" valign=\"top\" bgcolor=\"#EDF4FF\"><table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">          <tr bgcolor=\"#FFFFFF\">            <td height=\"29\" colspan=\"2\" align=\"center\" valign=\"top\"><img src=\"http://esupport.ready-online.com/themes/client_default/supportsuite.gif\"></td>          </tr>          <tr align=\"center\" bgcolor=\"#3894E5\">            <td height=\"1\" colspan=\"2\" valign=\"top\"><img src=\"http://esupport.ready-online.com/themes/client_default/space.gif\" width=\"1\" height=\"1\"></td>          </tr>          <tr align=\"center\">            <td colspan=\"2\" valign=\"top\"><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\"><br>              <br>              Need Assistance? Click &quot;Chat Now&quot; to chat with a our online service account.<br>              <br>              </font><br>              <br></td>          </tr>          <tr>            <td width=\"47%\" align=\"center\" valign=\"top\"><a href=\"javascript:doProactiveRequest_0d5c3faf();\"><font color=\"#FF3300\" size=\"4\" face=\"Trebuchet MS, Verdana, Arial, Helvetica, sans-serif\">Chat Now</font></a> </td>            <td width=\"53%\" align=\"center\" valign=\"top\"><a href=\"javascript:closeProactiveRequest_0d5c3faf();\"><font color=\"#6666FF\" size=\"4\" face=\"Trebuchet MS, Verdana, Arial, Helvetica, sans-serif\">No Thanks!</a></font></td>          </tr>        </table></td>      </tr>    </table></td>  </tr></table>";
	writedata += "</div>";
	Modalbox.show(writedata, {width: 450, height:400});		
}

function displayProactiveChatData_0d5c3faf()
{

	switchDisplay_0d5c3faf("proactivechatdiv");
}

function hideProactiveChatData_0d5c3faf()
{
	hideDisplay_0d5c3faf("proactivechatdiv");
}

function doProactiveForced_0d5c3faf()
{
	startChatNow_0d5c3faf("6");
}
function adsStartChat(){	
	Effect.toggle('adsDiv0d5c3faf','slide');
	startChatNow_0d5c3faf("6");
}
function adsClos(){	
	Effect.toggle('adsDiv0d5c3faf','slide');	
}
function doProactiveRequest_0d5c3faf()
{
	hideProactiveChatData_0d5c3faf();
	
	setTimeout("startChat_0d5c3faf(\"4\");", 1000);
}

function closeProactiveRequest_0d5c3faf()
{
	rejectProactive = new Image();
	date1 = new Date();
	rejectProactive.src = "http://esupport.ready-online.com/visitor/index.php?_m=livesupport&_a=resetproactivestatus&_s=rjp&time="+date1.getTime()+"&rand="+doRand_0d5c3faf()+"&sessionid="+sessionid_0d5c3faf;

	//hideProactiveChatData_0d5c3faf();
}

function switchDisplay_0d5c3faf(objid)
{
	writedata = "<div id=\"proactivechatdiv\">";
	writedata += "<table width=\"450\" height=\"200\"  border=\"0\" cellpadding=\"1\" cellspacing=\"0\">  <tr>    <td bgcolor=\"#3894E5\"><table width=\"450\" height=\"200\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">      <tr>        <td align=\"left\" valign=\"top\" bgcolor=\"#EDF4FF\"><table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">          <tr bgcolor=\"#FFFFFF\">            <td height=\"29\" colspan=\"2\" align=\"center\" valign=\"top\"><img src=\"http://esupport.ready-online.com/themes/client_default/supportsuite.gif\"></td>          </tr>          <tr align=\"center\" bgcolor=\"#3894E5\">            <td height=\"1\" colspan=\"2\" valign=\"top\"><img src=\"http://esupport.ready-online.com/themes/client_default/space.gif\" width=\"1\" height=\"1\"></td>          </tr>          <tr align=\"center\">            <td colspan=\"2\" valign=\"top\"><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\"><br>              <br>              Need Assistance? Click &quot;Chat Now&quot; to chat with a our online service account.<br>              <br>              </font><br>              <br></td>          </tr>          <tr>            <td width=\"47%\" align=\"center\" valign=\"top\"><a href=\"javascript:doProactiveRequest_0d5c3faf();\"><font color=\"#FF3300\" size=\"4\" face=\"Trebuchet MS, Verdana, Arial, Helvetica, sans-serif\">Chat Now</font></a> </td>            <td width=\"53%\" align=\"center\" valign=\"top\"><a href=\"javascript:closeProactiveRequest_0d5c3faf();\"><font color=\"#6666FF\" size=\"4\" face=\"Trebuchet MS, Verdana, Arial, Helvetica, sans-serif\">No Thanks!</a></font></td>          </tr>        </table></td>      </tr>    </table></td>  </tr></table>";
	writedata += "</div>";
	Modalbox.show(writedata, {title:(campaignTitle ? campaignTitle :"Need help?"), width: 480, height:400});		
}

function hideDisplay_0d5c3faf(objid)
{

	try{
	Modalbox.hide();
	}catch(err){}
}

function resetChatStatus_0d5c3faf()
{
	isChatRunning_0d5c3faf = 0;
}

function runURL_0d5c3faf(url)
{
	runURLImg = new Image();
	date1 = new Date();
	runURLImg.src = url;
}
function loadAdsScript_0d5c3faf(){
		var head;
		var script;
		head = $$('head')[0];
		var scriptUrl = "http://esupport.ready-online.com/visitor/index.php?_m=livesupport&_a=script_ads&rand="+doRand_0d5c3faf()+"&sessionid="+sessionid_0d5c3faf+"&url="+encodeURIComponent(window.location)+"&country="+encodeURIComponent(country_0d5c3faf)+"&countrycode="+encodeURIComponent(countrycode_0d5c3faf);
		if (head)
		{
		    script = new Element('script', { 
		    type: 'text/javascript', 
		    src: scriptUrl 
		    });
		    head.appendChild(script);
		}		
		adsIsLoad = 1;
		campaigntitle_0d5c3faf = campaignTitle;		
}

function runAds_0d5c3faf()
{
if(isChatRunning_0d5c3faf == 1){return;}
if(adsJunptimes_0d5c3faf > 2){return;}
setTimeout("loadAdsScript_0d5c3faf();", 3000);
var jshtml = adsContent;
if(jshtml){
if($('adsDiv0d5c3faf')){$('adsDiv0d5c3faf').remove();}
		var body = document.getElementsByTagName('body')[0];	
		if(	browsercode == "IE" && browserversion <= 6 && (typeof document.body.style.maxHeight == "undefined")){
			// var b_width = document.body.offsetWidth;
			// $(body).setStyle({'height': '100%',overflow: 'auto'});
			// $(body).insert(new Element('div',{'id': 'adsDiv0d5c3faf'}).setStyle({'overflowX': 'auto',zIndex: '9999',position: 'absolute',bottom: '0px','_top': 'expression(documentElement.scrollTop+documentElement.clientHeight-this.clientHeight-4)',display: 'block',width: winW,left: '0px'}).update(jshtml).hide(),'bottom');
		}else if(browsercode == "IE" && (typeof document.body.style.maxHeight != "undefined")){
			$(body).insert(new Element('div',{'id': 'adsDiv0d5c3faf'}).setStyle({zIndex: '9999',position: 'fixed',bottom: '0px',display: 'block',width: winW,margin: '0px',left: '0px'}).update(jshtml).hide(),'bottom');
		}else{
			$(body).insert(new Element('div',{'id': 'adsDiv0d5c3faf'}).setStyle({zIndex: '9999',position: 'fixed',bottom: '0px',display: 'block',width: '100%'}).update(jshtml).hide(),'bottom');
		}
		showAds_0d5c3faf();
		adsJunptimes_0d5c3faf = adsJunptimes_0d5c3faf +1;
	}
	window.setTimeout('runAds_0d5c3faf()',30000);
}
function showAds_0d5c3faf(){
	Effect.toggle('adsDiv0d5c3faf','slide');
}
function updateEsupportIcon(){
	$$('div#esupport').invoke('update',"<a href=\"javascript:startChat_0d5c3faf(\'0\');\" onMouseOver=\"window.status=\'Oops! We\'re very sorry, our service account is offline. Click Here to leave a message\'; return true;\" onMouseOut=\"window.status=\'\'; return true;\"><img src=\"http://esupport.ready-online.com/themes/client_default/staffoffline.gif\" border=\"0\" alt=\"Oops! We\'re very sorry, our service account is offline. Click Here to leave a message\" title=\"Oops! We\'re very sorry, our service account is offline. Click Here to leave a message\"></a>");
}

	window.setTimeout('updateEsupportIcon()',3000);	
elapsedTime_0d5c3faf();
runAds_0d5c3faf();
