document.write('<div id="iCoder_POP1141877261" style="overflow:hidden;position:absolute;display:none;top:5000;left:0;width:425px;height:215px;background-color:#ff9933;z-index:9999;cursor:move;" onmousedown="initializedrag(event)" onmouseup="stopdrag()" ><table id="mainTable" cellspacing="0" cellpadding="2" style="top:4px; left:4px; position: absolute; width:417px; height:207px; font:normal 10pt Verdana;border:1px solid navy;"><tr style="height:100%"><td id="colorCell" style="background-color:#ff9933;color:black;">');
document.write('<div id="agent_info" style="width:100%;vertical-align:middle"></div>');
document.write('</td></tr></table></div>');

// To prevent appending to document.body from a non direct descendant before the whole document is loaded (an IE bug that kills the page),
// set a flag in the onload event to check.
var IsDocumentLoaded = false;
function SetLoadedFlag()
{
    IsDocumentLoaded = true;
}
var oldOnloadHandler = (window.onload) ? window.onload : function() {};
window.onload = function() { oldOnloadHandler(); SetLoadedFlag();};


function readCookie() {
	var nameEQ = "popinCount=";
	var ca = document.cookie.split(';');
	for(var i=0;i<ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function setCookie(value,hours){
	var date = new Date();
	date.setTime(date.getTime()+(hours*60*60*1000));
	
	if(/popinCount/.test(document.cookie))
	{
		//The /popinCount/.test(document.cookie) is a regular expression search
		//it returns true if the string 'popinCount' is found in the the cookie.
		//So, if the popinCount cookie already exists, we use its expireDate instead
		//of incrementing current time by the specified amount.
		date = unescape(document.cookie).split('CaoPopinCookieExpireDate=')[1]; 
    }
    
    // The ,CaoPopinCookieExpireDate is attached to the actual cookie value so that future hits will be able to find
    // the expire date of the cookie to reuse when they modify the popincount value.
    document.cookie = 'popinCount='+value+',CaoPopinCookieExpireDate='+date+';expires='+date;
} 

///////////////////////////////////////////////////////////////
// Pop-In Builder (c)2004.  iCoder.com  All Rights Reserved. //
///////////////////////////////////////////////////////////////


function iPop_close(pop_name) {
  if(!pop_name) pop_name = "iCoder_POP1141877261";
  DHTMLAPI_hide(pop_name);
}
function iPop1141877261_close() { DHTMLAPI_hide("iCoder_POP1141877261"); }
function iPop1141877261_init0() {
  DHTMLAPI_init();
  iCoder_POP1141877261_Obj = DHTMLAPI_getRawObject("iCoder_POP1141877261");
  iCoder_POP1141877261_move();
  window.onscroll=iCoder_POP1141877261_move;
  window.onresize=iCoder_POP1141877261_move;
}
function iPop1141877261_init1() {
 if (!IsDocumentLoaded)
  {
     // Since we append the dropin div to the body (in order to adjust for the code not being included directly in the body of the document)
     // we have to be sure the document has fully loaded first to avoid an IE bug.
     setTimeout("iPop1141877261_init1()", 500);
     return;
  }
  DHTMLAPI_init();
  iCoder_POP1141877261_delta = 16;
  iCoder_POP1141877261_Obj = DHTMLAPI_getRawObject("iCoder_POP1141877261");
 
  document.body.appendChild(iCoder_POP1141877261_Obj);

  var theObj = iCoder_POP1141877261_Obj; if (theObj && isCSS) theObj = theObj.style;
  if (theObj && theObj.visibility == "hidden") return;
  if (theObj && theObj.display == "none") { theObj.display = "block"; theObj.position = "absolute"; }
  DHTMLAPI_shiftTo(iCoder_POP1141877261_Obj, 0, 5000);
  var center = DHTMLAPI_positionWindow(iCoder_POP1141877261_Obj, true);
  iCoder_POP1141877261_x = center[0];
  iCoder_POP1141877261_y = center[1];
  var w_scroll = DHTMLAPI_getScrollWindow();
  var start_y = parseInt((w_scroll[1]-iCoder_POP1141877261_y-DHTMLAPI_getObjectHeight(iCoder_POP1141877261_Obj)-100)/100)*100 + iCoder_POP1141877261_y;
  DHTMLAPI_shiftTo(iCoder_POP1141877261_Obj, iCoder_POP1141877261_x, start_y);
  iCoder_POP1141877261_dropstart=setInterval("iCoder_POP1141877261_drop()",50);
}
function iCoder_POP1141877261_move() {
  if (window.iCoder_POP1141877261_timeout) clearTimeout(window.iCoder_POP1141877261_timeout);
  if (!iCoder_POP1141877261_Obj) return;
  var theObj = iCoder_POP1141877261_Obj; if (theObj && isCSS) theObj = theObj.style;
  if (theObj && theObj.visibility == "hidden") return;
  if (theObj && theObj.display == "none") { theObj.display = "block"; theObj.position = "absolute"; }
  DHTMLAPI_positionWindow(iCoder_POP1141877261_Obj);
//  window.iCoder_POP1141877261_timeout = setTimeout("iCoder_POP1141877261_move()", 100);
}
function DHTMLAPI_positionWindow(elemID, positionOnly) {
  var obj = DHTMLAPI_getRawObject(elemID);
  var position = obj.getAttribute("pos");
  var scrollX = 0, scrollY = 0;
  if (document.body && typeof(document.body.scrollTop) != "undefined") {
    scrollX += document.body.scrollLeft;
    scrollY += document.body.scrollTop;
    if (0 == document.body.scrollTop
    && document.documentElement
    && typeof(document.documentElement.scrollTop) != "undefined") {
      scrollX += document.documentElement.scrollLeft;
      scrollY += document.documentElement.scrollTop;
    }	
  } else if (typeof(window.pageXOffset) != "undefined") {
    scrollX += window.pageXOffset;
    scrollY += window.pageYOffset;
  }
  var x = Math.round((DHTMLAPI_getInsideWindowWidth( )/2) - (DHTMLAPI_getObjectWidth(obj)/2)) + scrollX;
  var y = Math.round((DHTMLAPI_getInsideWindowHeight( )/2) - (DHTMLAPI_getObjectHeight(obj)/2)) + scrollY;
  var shift_position = parseInt(0);
  if (isNaN(shift_position)) shift_position = 0;
  switch (position) {
    case "tc": y = scrollY+shift_position; break;
    case "tl": y = scrollY+shift_position; x = scrollX+shift_position; break;
    case "tr": y = scrollY+shift_position; x = Math.round(DHTMLAPI_getInsideWindowWidth( ) - DHTMLAPI_getObjectWidth(obj)) + scrollX-shift_position; break;
    case "ml": x = scrollX+shift_position; break;
    case "mr": x = Math.round(DHTMLAPI_getInsideWindowWidth( ) - DHTMLAPI_getObjectWidth(obj)) + scrollX-shift_position; break;
    case "bc": y = Math.round(DHTMLAPI_getInsideWindowHeight( ) - DHTMLAPI_getObjectHeight(obj)) + scrollY-shift_position; break;
    case "bl": y = Math.round(DHTMLAPI_getInsideWindowHeight( ) - DHTMLAPI_getObjectHeight(obj)) + scrollY-shift_position; x = scrollX+shift_position; break;
    case "br": y = Math.round(DHTMLAPI_getInsideWindowHeight( ) - DHTMLAPI_getObjectHeight(obj)) + scrollY-shift_position; x = Math.round(DHTMLAPI_getInsideWindowWidth( ) - DHTMLAPI_getObjectWidth(obj)) + scrollX-shift_position; break;
  }
  if (!positionOnly) DHTMLAPI_shiftTo(obj, x, y);
  return [x, y];
}
function iCoder_POP1141877261_drop() {
  var y = DHTMLAPI_getObjectTop(iCoder_POP1141877261_Obj);
  if ( iCoder_POP1141877261_y > y ) DHTMLAPI_shiftTo(iCoder_POP1141877261_Obj, iCoder_POP1141877261_x, 50+y);
  else {
    clearInterval(iCoder_POP1141877261_dropstart);
    iCoder_POP1141877261_vibrostart = setInterval("iCoder_POP1141877261_vibro()",40);
  }
}
function iCoder_POP1141877261_vibro() {
  var y = DHTMLAPI_getObjectTop(iCoder_POP1141877261_Obj);
  DHTMLAPI_shiftTo(iCoder_POP1141877261_Obj, iCoder_POP1141877261_x, y-iCoder_POP1141877261_delta);
  if (iCoder_POP1141877261_delta<0) iCoder_POP1141877261_delta += 4;
  iCoder_POP1141877261_delta *= -1;
  if (iCoder_POP1141877261_delta==0) {
    clearInterval(iCoder_POP1141877261_vibrostart);
    iCoder_POP1141877261_move();
//    window.onscroll=iCoder_POP1141877261_move;
//    window.onresize=iCoder_POP1141877261_move;
  }
}
function DHTMLAPI_hide(obj) {
  var theObj = DHTMLAPI_getObject(obj);
  if (theObj) theObj.visibility = "hidden";
  if (document.images)
  {
		for(var i=0; i<document.images.length; i++)
		{
			document.images[i].src = document.images[i].src;
		}
  }
}
function DHTMLAPI_getRawObject(obj) {
  var theObj;
  if (typeof obj == "string") {
    if (isW3C) theObj = document.getElementById(obj);
    else if (isIE4) theObj = document.all(obj);
    else if (isNN4) theObj = DHTMLAPI_seekLayer(document, obj);
  } else theObj = obj;
  return theObj;
}
function DHTMLAPI_shiftTo(obj, x, y) {
  var theObj = DHTMLAPI_getObject(obj);
  if (theObj) {
    if (isCSS) {
      var units = (typeof theObj.left == "string") ? "px" : 0;
      theObj.left = x + units;
      theObj.top = y + units;
    } else if (isNN4) theObj.moveTo(x,y);
  }
}
function DHTMLAPI_getScrollWindow() {
  var scrollX = 0, scrollY = 0;
  if (document.body && typeof(document.body.scrollTop) != "undefined") {
    scrollX += document.body.scrollLeft;
    scrollY += document.body.scrollTop;
  } else if (typeof(window.pageXOffset) != "undefined") {
    scrollX += window.pageXOffset;
    scrollY += window.pageYOffset;
  }
  return [scrollX, scrollY];
}
function DHTMLAPI_getObjectHeight(obj)  {
  var elem = DHTMLAPI_getRawObject(obj);
  var result = 0;
  if (elem.offsetHeight) result = elem.offsetHeight;
  else if (elem.clip && elem.clip.height) result = elem.clip.height;
  else if (elem.style && elem.style.pixelHeight) result = elem.style.pixelHeight;
  return parseInt(result);
}
function DHTMLAPI_getObjectTop(obj)  {
  var elem = DHTMLAPI_getRawObject(obj);
  var result = 0;
  if (document.defaultView) {
    var style = document.defaultView;
    var cssDecl = style.getComputedStyle(elem, "");
    result = cssDecl.getPropertyValue("top");
  }
  else if (elem.currentStyle) result = elem.currentStyle.top;
  else if (elem.style) result = elem.style.top;
  else if (isNN4) result = elem.top;
  return parseInt(result);
}
function DHTMLAPI_getObject(obj) {
  var theObj = DHTMLAPI_getRawObject(obj);
  if (theObj && isCSS) theObj = theObj.style;
  return theObj;
}
function DHTMLAPI_seekLayer(doc, name) {
  var theObj;
  for (var i = 0; i < doc.layers.length; i++) {
    if (doc.layers[i].name == name) {
      theObj = doc.layers[i];
      break;
    }
    if (doc.layers[i].document.layers.length > 0) theObj = DHTMLAPI_seekLayer(document.layers[i].document, name);
  }
  return theObj;
}

function DHTMLAPI_getInsideWindowWidth( ) {
  if (window.innerWidth) 
  {
      return (window.innerWidth - 16);
  }
  else if ((document.documentElement) && 
           (document.documentElement.clientWidth) && 
           (document.documentElement.clientWidth > 0))
  {
	return document.documentElement.clientWidth
  }
  else if (document.body && document.body.clientWidth) 
  {
      return document.body.clientWidth;
  }
  return 0;
}
function DHTMLAPI_getInsideWindowHeight( ) {
  if (window.innerHeight) 
  {
      return (window.innerHeight - 16);
  }
  else if ((document.documentElement) && 
           (document.documentElement.clientHeight) && 
           (document.documentElement.clientHeight > 0))
  {
	return document.documentElement.clientHeight
  }
  else if (document.body && document.body.clientHeight) 
  {
      return document.body.clientHeight;
  }
  return 0;
}
function DHTMLAPI_getObjectWidth(obj)  {
  var elem = DHTMLAPI_getRawObject(obj);
  var result = 0;
  if (elem.offsetWidth) result = elem.offsetWidth;
  else if (elem.clip && elem.clip.width) result = elem.clip.width;
  else if (elem.style && elem.style.pixelWidth) result = elem.style.pixelWidth;
  return parseInt(result);
}
function DHTMLAPI_init( ) {
  if (document.images) {
    isCSS = (document.body && document.body.style) ? true : false;
    isW3C = (isCSS && document.getElementById) ? true : false;
    isIE4 = (isCSS && document.all) ? true : false;
    isNN4 = (document.layers) ? true : false;
    isIE6CSS = false; // (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
  }
}

// Movable Div Code
var dragapproved=false
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("iCoder_POP1141877261").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("iCoder_POP1141877261").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("iCoder_POP1141877261").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("iCoder_POP1141877261").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
tempx=parseInt(document.getElementById("iCoder_POP1141877261").style.left)
tempy=parseInt(document.getElementById("iCoder_POP1141877261").style.top)

dragapproved=true
document.getElementById("iCoder_POP1141877261").onmousemove=drag_drop
}

function stopdrag(){
dragapproved=false;
document.getElementById("iCoder_POP1141877261").onmousemove=null;
}

function scaleObjectByWidth(target, newWidth)
{
	if (target.width <= newWidth)
	{
		return;
	}
	var originalWidth = target.width;
	var originalHeight = target.height;

	var ratio = (newWidth/originalWidth);
	var newHeight = parseInt(ratio * originalHeight);

	target.width = newWidth;
	target.height = newHeight;
}

