/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();

function VirtualAgent(){
	this.build = "2_1_01";
	this.appAbsPath = "http://www2.discounteo.com/skin/frontend/discounteo/default/tea/";
	this.width = "230";
	this.height = "350";
	this.wmode="transparent";
	this.swfUrl = this.appAbsPath + "Discounteo.swf?b=" + this.build;
	this.flashversion = "9";
	this.botid = "agentContainer"; //id of div containing flash
	this.isPopin = false;
	this.css = {
		Lg: {width:'280px', height:'423px', background:'url(amelie_lg.png) no-repeat top left', cursor:'move', display:'block', position:'fixed'},
		Content: {padding:'23px 0 0 8px'},
		Sm: {width:'280px', height:'58px', background:'url(amelie_reduce.png) no-repeat top left', position:'fixed', right:'10px', bottom:'10px'},
		CloseX: {top:'10px', right:'10px', width:'14px', height:'15px', background: 'url(closeX.png) no-repeat 0px -33px', display:'block', position:'absolute', overflow:'hidden'},
		CloseXS: {top:'10px', right:'10px', width:'14px', height:'15px', background: 'url(closeX.png) no-repeat 0px -33px', display:'block', position:'absolute', overflow:'hidden'}
	};
};

VirtualAgent.prototype = {
	
	bind: function( fn ) {
		var me = this;
		return( function(){ return( fn.apply( me, arguments ) ); } );
	},
	
	init: function(){		
		
		var flashvars = { appAbsPath:this.appAbsPath };
		var params = { menu:"false", bgcolor:"#ffffff", allowScriptAccess:"always", wmode:"transparent" };
		var attributes = {};
		swfobject.embedSWF(this.swfUrl, this.botid, this.width, this.height, this.flashversion, this.appAbsPath + "expressInstall.swf", flashvars, params, attributes);
		if( this.isPopin ) {
			document.getElementById(this.botid).style.display = "none";
			if( this.isOpen = this.getCookie("popinOpen") ) {
				this.savedX = this.getCookie("popinX");
				this.savedY = this.getCookie("popinY");
				
				if (this.isOpen == 'L') {
					this.showPopin(parseInt(this.savedX), parseInt(this.savedY));
				}
				else if (this.isOpen == 'S') {
					this.showReduce();
				}
			}
			
			/*TODO
			jt_AddListener(window, "resize", VirtuOz.chkPos);
			if (jt_isIE) setInterval("VirtuOz.chkScroll()", 50);
			*/
		}
	},
	flashLoadedHandler: function(){
		/* method stub. this can be overriden from outside (see end of file) */
	},
	
	showPopin: function(x, y) {
		
		/*TODO
		if (this.wrapSm) this.wrapSm.blur();
		*/
		if (typeof x == 'object') {
			var e = jt_fixE(x);
			var node = e.target ? e.target : e.srcElement;
			if (node == this.wrapSm.closeX) return;
		}
		jt_ShowHideElm(this.wrapSm);
		if (!this.wrapLg) {
			this.wrapLg = document.createElement('div');
			this.wrapLg.id = 'VirtuOzLgWrap'; // for optional CSS/stylesheet
			jt_cssApply(this.css.Lg, this.wrapLg);
			if (jt_isIE) { // 'position:fixed' not supported!
				this.wrapLg.style.position = 'absolute';
			}

			this.lgContent = document.createElement('div');
			jt_cssApply(this.css.Content, this.lgContent);
			this.wrapLg.appendChild(this.lgContent);
			this.widget = document.getElementById(this.botid);
			this.lgContent.appendChild(this.widget);
			jt_ShowNoneElm(this.widget, true);

			/*TODO
			if (VirtuOz.lgHTML) {
				VirtuOz.wrapLgTxt = document.createElement('span');
				jt_cssApply(VirtuOz.css.LgTxt, VirtuOz.wrapLgTxt);
				VirtuOz.wrapLgTxt.innerHTML = VirtuOz.lgHTML;
				VirtuOz.wrapLg.appendChild(VirtuOz.wrapLgTxt);
			}
			*/
			
			this.wrapLg.closeX = document.createElement('a');
			jt_cssApply(this.css.CloseX, this.wrapLg.closeX);
			this.wrapLg.closeX.href = "";
			this.wrapLg.closeX.title = "Close";
			this.wrapLg.closeX.onclick = function(){return false;};
			this.wrapLg.appendChild(this.wrapLg.closeX);
			jt_AddListener(this.wrapLg.closeX, 'click', this.bind( this.showReduce ));
			jt_AddListener(this.wrapLg.closeX, 'mouseover', this.bind(function() {jt_cssApply(this.css.CloseXHover, this.wrapLg.closeX);}));
			jt_AddListener(this.wrapLg.closeX, 'mouseout', this.bind(function() {jt_cssApply(this.css.CloseX, this.wrapLg.closeX);}));
			
			document.body.appendChild(this.wrapLg);
			Drag.init(this.wrapLg, null, 0, null, 0);
			this.wrapLg.onDragEnd = this.bind( this.saveBoxPos );
		}
		if (arguments.length != 2) {
			x = jt_winW() - this.wrapLg.offsetWidth - parseInt(this.css.Sm.right) + jt_scrollLeft();
			y = jt_winH() - this.wrapLg.offsetHeight - parseInt(this.css.Sm.bottom) + jt_scrollTop();
		}
		jt_moveTo(this.wrapLg, x, y);
		
		this.chkPos();
		jt_ShowHideElm(this.wrapLg, true);
		jt_ShowHideElm(this.widget, true);
		this.saveBoxPos("L");
	},
	
	showReduce: function() {
		jt_ShowHideElm(this.wrapLg);
		jt_ShowHideElm(this.widget);
		
		if (!this.wrapSm) {
			this.wrapSm = document.createElement('a');
			this.wrapSm.id = 'VirtuOzSmWrap'; // for optional CSS/stylesheet
			jt_cssApply(this.css.Sm, this.wrapSm);
			if (jt_isIE) { // 'position:fixed' not supported!
				this.wrapSm.style.position = 'absolute';
			}
			this.wrapSm.href = "&nbsp;";
			this.wrapSm.onclick = function(){return false;};
			jt_AddListener(this.wrapSm, "click", this.bind( this.showPopin ));

			/*TODO
			if (VirtuOz.smHTML) {
				VirtuOz.wrapSmTxt = document.createElement('span');
				jt_cssApply(VirtuOz.css.SmTxt, VirtuOz.wrapSmTxt);
				VirtuOz.wrapSmTxt.innerHTML = VirtuOz.smHTML;
				VirtuOz.wrapSm.appendChild(VirtuOz.wrapSmTxt);
			}
			*/
			this.wrapSm.closeX = document.createElement('a');
			jt_cssApply(this.css.CloseXS, this.wrapSm.closeX);
			this.wrapSm.closeX.href = "";
			this.wrapSm.closeX.title = "Close";
			this.wrapSm.closeX.onclick = function(){return false;};
			this.wrapSm.appendChild(this.wrapSm.closeX);
			jt_AddListener(this.wrapSm.closeX, 'click', this.bind( function() { jt_ShowHideElm(this.wrapSm); this.saveBoxPos(""); } ) );
			jt_AddListener(this.wrapSm.closeX, 'mouseover', this.bind( function() {jt_cssApply(this.css.CloseXHoverS, this.wrapSm.closeX);} ));
			jt_AddListener(this.wrapSm.closeX, 'mouseout', this.bind( function() {jt_cssApply(this.css.CloseXS, this.wrapSm.closeX);} ));

			document.body.appendChild(this.wrapSm);
		}
		
		/*TODO
		if (jt_isIE) {
			jt_moveTo(VirtuOz.wrapSm,
				jt_winW() + jt_scrollLeft() - VirtuOz.wrapSm.offsetWidth - parseInt(VirtuOz.css.Sm.right),
				jt_winH() + jt_scrollTop() - VirtuOz.wrapSm.offsetHeight - parseInt(VirtuOz.css.Sm.bottom)
			);
		}
		*/
		jt_ShowHideElm(this.wrapSm, true);
		this.saveBoxPos("S");
	},
	
	saveBoxPos: function( isOpen ) {
		this.savedX = parseInt(this.wrapLg.style.left) - jt_scrollLeft();
		this.savedY = parseInt(this.wrapLg.style.top) - jt_scrollTop();
		this.setCookie("popinX",this.savedX,"session");
		this.setCookie("popinY",this.savedY,"session");
		this.setCookie("popinOpen",isOpen,"session");
	},
	
	setMinMax: function() {
		var w = jt_width(this.wrapLg);
		var h = jt_height(this.wrapLg);
		var winSizeX = jt_winW();
		var winSizeY = jt_winH();
		this.wrapLg.minX = Math.min(0, winSizeX - w) + (jt_isIE ? jt_scrollLeft() : 0);
		this.wrapLg.minY = Math.min(0, winSizeY - h) + (jt_isIE ? jt_scrollTop() : 0);
		this.wrapLg.maxX = Math.max(0, winSizeX - w) + (jt_isIE ? jt_scrollLeft() : 0);
		this.wrapLg.maxY = Math.max(0, winSizeY - h) + (jt_isIE ? jt_scrollTop() : 0);
	},
	
	chkPos: function() {
		if (this.wrapLg) {
			this.setMinMax();
			var moved = false;
			this.wrapLg.vOzPoint = jt_getOffsetXY(this.wrapLg, null, this.wrapLg.vOzPoint);
			if (this.wrapLg.vOzPoint.x > this.wrapLg.maxX) {
				moved = true;
				this.wrapLg.style.left = jt_valPx(this.wrapLg.maxX);
			}
			else if (this.wrapLg.vOzPoint.x < this.wrapLg.minX) {
				moved = true;
				this.wrapLg.style.left = jt_valPx(this.wrapLg.minX);
			}
			if (this.wrapLg.vOzPoint.y > this.wrapLg.maxY) {
				moved = true;
				this.wrapLg.style.top = jt_valPx(this.wrapLg.maxY);
			}
			else if (this.wrapLg.vOzPoint.y < this.wrapLg.minY)  {
				moved = true;
				this.wrapLg.style.top = jt_valPx(this.wrapLg.minY);
			}
			if (moved) {this.saveBoxPos("L");}
		}
	},

	scrollSpeed: 0.75,
	chkScroll: function() {
		if (Drag.obj == null) {
			if (VirtuOz.wrapLg && (VirtuOz.boxMem.isOpen == 'L')) {
				var newX = parseInt(VirtuOz.boxMem.x) + jt_scrollLeft();
				var newY = parseInt(VirtuOz.boxMem.y) + jt_scrollTop();
				VirtuOz.wrapLg.vOzPoint = jt_getOffsetXY(VirtuOz.wrapLg, null, VirtuOz.wrapLg.vOzPoint);
				if ((newX != VirtuOz.wrapLg.vOzPoint.x) || (newY != VirtuOz.wrapLg.vOzPoint.y)) {
					jt_moveTo(VirtuOz.wrapLg,
						VirtuOz.wrapLg.vOzPoint.x + Math.round((newX - VirtuOz.wrapLg.vOzPoint.x) * VirtuOz.scrollSpeed),
						VirtuOz.wrapLg.vOzPoint.y + Math.round((newY - VirtuOz.wrapLg.vOzPoint.y) * VirtuOz.scrollSpeed)
					);
					VirtuOz.setMinMax();
				}
			}
			else if (VirtuOz.wrapSm && (VirtuOz.boxMem.isOpen == 'S')) {
				VirtuOz.wrapSm.vOzPoint = jt_getOffsetXY(VirtuOz.wrapSm, null, VirtuOz.wrapSm.vOzPoint);
				var newY = jt_winH() + jt_scrollTop() - VirtuOz.wrapSm.offsetHeight - parseInt(VirtuOz.css.Sm.bottom);
				if (newY != VirtuOz.wrapSm.vOzPoint.y) {
					VirtuOz.wrapSm.style.top = jt_valPx(VirtuOz.wrapSm.vOzPoint.y + Math.round((newY - VirtuOz.wrapSm.vOzPoint.y) * VirtuOz.scrollSpeed));
				}
			}
		}
	},
	
	getCookie: function( cookieName ) {		
		/*only cookies for this domain and path will be retrieved */
		var cookieJar = document.cookie.split( "; " );
		for( var x = 0; x < cookieJar.length; x++ ) {
			var oneCookie = cookieJar[x].split( "=" );
			if( oneCookie[0] == escape( cookieName ) ) { return oneCookie[1] ? unescape( oneCookie[1] ) : ''; }
		}
		return null;
	},

	setCookie: function( cookieName, cookieValue, lifeTime, path, domain, isSecure ) {
		/*alert('inside setcookie: ' + 'name:'+ cookieName + ' ' + 'value: ' + cookieValue + ' ' + 'lifetime:' + lifeTime + 'path:' + path );*/
		if( !cookieName ) { return false; }

		if( lifeTime == "delete" ) { lifeTime = -10; } /*this is in the past. Expires immediately.*/
		if( lifeTime == undefined)
			lifeTime = 30 * 60 * 60 * 24;
		if( lifeTime == "followUp" || lifeTime == "contextID" || lifeTime == "interlocutorID" || lifeTime == "contextFlag" || lifeTime == "contextInfo")
			lifeTime = 30 * 60;
		if( lifeTime == "history")
			lifeTime = 30 * 24 * 60 * 60;
			
		if( path == undefined || path == '' )
			 path = "/";
		/* This next line sets the cookie but does not overwrite other cookies.
		syntax: cookieName=cookieValue[;expires=dataAsString[;path=pathAsString[;domain=domainAsString[;secure]]]]
		Because of the way that document.cookie behaves, writing this here is equivalent to writing
		document.cookie = whatIAmWritingNow + "; " + document.cookie; */
		document.cookie = escape( cookieName ) + "=" + escape( cookieValue ) +
			( lifeTime!='session' ? ";expires=" + ( new Date( ( new Date() ).getTime() + ( 1000 * lifeTime ) ) ).toGMTString() : "" ) +
			( path ? ";path=" + path : "") + ( domain ? ";domain=" + domain : "") + 
			( isSecure ? ";secure" : "");
		/*check if the cookie has been set/deleted as required*/
		if( lifeTime < 0 ) { if( typeof( this.getCookie( cookieName ) ) == "string" ) { return false; } return true; }
		if( typeof( this.getCookie( cookieName ) ) == "string" ) { return true; } return false;
	},
	
	sendParam: function ( name, value ) {
		try {
		  document.getElementById(this.botid).sendParam( name, value );
		}catch(e){
			if(console) console.warn(e.message);
		}
	},
	
	setMask: function ( bgColor, bgAlpha ) {
		try {
		  document.getElementById(this.botid).setMask( bgColor, bgAlpha );
		}catch(e){
			if(console) console.warn(e.message);
		}
	}
};

/**
 * NOTE: subset of jt_.js, combined with dom-drag.js, as single include file, for VirtuOz.com - July 19, 2009
 *
 * jt_.js (was 'jt_utils.js') - "JavaScript Toolkit" 
 *
 * Copyright (c) 2005-2009 by Joseph Oster, wingo.com
 * http://www.wingo.com/jt_/jt_.js
 * @license http://www.wingo.com/jt_/jt_license.html
 */

function jt_ShowHideElm(elm, showIt) {
	if (elm) {elm.style.visibility = (showIt) ? "visible" : "hidden";}
}

function jt_ShowNoneElm(elm, showIt, showStyle) {
	if (elm) {elm.style.display = showIt ? (showStyle ? showStyle : 'block') : "none";}
}

function jt_ShowHide(divName, showIt) {
	jt_ShowHideElm(document.getElementById(divName), showIt);
}

function jt_ShowNone(divName, showIt, showStyle) {
	jt_ShowNoneElm(document.getElementById(divName), showIt, showStyle);
}

function jt_valPx(pixels) {
	return isNaN(pixels) ? 0 : pixels + "px";
}

function jt_moveTo(obj, x, y) {
	obj.style.left = jt_valPx(x);
	obj.style.top = jt_valPx(y);
}

function jt_Point(x, y) {
	// returns a "Point" object with '.x' and '.y' properties
	this.x = x;
	this.y = y;
}

function jt_getOffsetXY(obj, findID, point) {
	// returns 'jt_Point' object with '.x' and '.y' offsets of 'obj' relative to page
	// or relative to optional 'findID', if 'findID' is found as a parent
	if (point) { // optional 'point' is re-used when valid; good practice when dragging
		point.x = obj.offsetLeft;
		point.y = obj.offsetTop;
	}
	else {point = new jt_Point(obj.offsetLeft, obj.offsetTop);}
	var parent = obj.offsetParent;
	while (parent !== null) {
		if (findID && (parent.id == findID)) break;
		point.x += parent.offsetLeft;
		point.y += parent.offsetTop;
		parent = parent.offsetParent;
	}
	return point;
}

function jt_AddListener(obj, evType, fn) {
	if (obj.addEventListener) {obj.addEventListener(evType, fn, false);}
	else if (obj.attachEvent) {obj.attachEvent('on' + evType, fn);}
}

function jt_RemListener(obj, evType, fn) {
	if (obj.removeEventListener) {obj.removeEventListener(evType, fn, false);}
	else if (obj.detachEvent) {obj.detachEvent('on' + evType, fn);}
}

function jt_fixE(ev) {
	var e = ev ? ev : window.event;
	return e;
}

function jt_cssApply(cssList, toDIV) {
	for (var prop in cssList) toDIV.style[prop] = cssList[prop];
}

function jt_currStyle(divToRead) { // return current (derived) CSS style object
	var cs = divToRead.style;
	if (window.getComputedStyle) {cs = window.getComputedStyle(divToRead,null);}
	else if (divToRead.currentStyle) {cs = divToRead.currentStyle;}
	return cs;
}

function jt_width(divToRead, currStyle) {
	var wide = currStyle ? currStyle.width : jt_currStyle(divToRead).width;
	return (wide = 'auto') ? divToRead.offsetWidth : parseInt(wide);
}

function jt_height(divToRead, currStyle) {
	var high = currStyle ? currStyle.height : jt_currStyle(divToRead).height;
	return (high = 'auto') ? divToRead.offsetHeight : parseInt(high);
}

function jt_winW() {
	if (document.documentElement && (document.documentElement.clientWidth > 0)) {return document.documentElement.clientWidth;}
	else if (window.innerWidth) {return window.innerWidth;}
	else {return document.body.clientWidth;}
}

function jt_winH() {
	if (window.innerHeight) {return window.innerHeight;}
	else if (document.documentElement && (document.documentElement.clientHeight > 0)) {return document.documentElement.clientHeight;}
	else {return document.body.clientHeight;}
}

function jt_scrollLeft() {
	if (window.pageXOffset) {return window.pageXOffset;}
	else if (document.documentElement && (document.documentElement.scrollLeft > 0)) {return document.documentElement.scrollLeft;}
	else {return document.body.scrollLeft;}
}

function jt_scrollTop() {
	if (window.pageYOffset) {return window.pageYOffset;}
	else if (document.documentElement && (document.documentElement.scrollTop > 0)) {return document.documentElement.scrollTop;}
	else {return document.body.scrollTop;}
}

function jt_objClone(obj) {
	var newObj = {};
	for (var prop in obj) {
		newObj[prop] = (typeof obj[prop] == 'object') ? jt_objClone(obj[prop]) : obj[prop];
	}
	return newObj;
}

var BrowserDetect = { // NOTE: from http://www.quirksmode.org/js/detect.html
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) !== -1) return data[i].identity;
				}
			else if (dataProp) return data[i].identity;
			}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{string: navigator.vendor, subString: "Apple", identity: "Safari"},
		{prop: window.opera, identity: "Opera"},
		{string: navigator.vendor, subString: "iCab", identity: "iCab"},
		{string: navigator.vendor, subString: "KDE", identity: "Konqueror"},
		{string: navigator.userAgent, subString: "Firefox", identity: "Firefox"},
		{string: navigator.userAgent, subString: "Netscape", identity: "Netscape"},	// for newer Netscapes (6+)
		{string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE"},
		{string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv"},
		{string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla"} // for older Netscapes (4-)
		],
	dataOS : [
		{string: navigator.platform, subString: "Win", identity: "Windows"},
		{string: navigator.platform, subString: "Mac", identity: "Mac"},
		{string: navigator.platform, subString: "Linux", identity: "Linux"}
		]
};

BrowserDetect.init();
var jt_isIE = (BrowserDetect.browser == 'Explorer');
var jt_FixIE6 = jt_isIE && (BrowserDetect.version < 7);



/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 **************************************************
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.
 **************************************************/

var Drag = {
	obj : null,
	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) {
		o.onmousedown = Drag.start;
		o.hmode = bSwapHorzRef ? false : true;
		o.vmode = bSwapVertRef ? false : true;
		o.root = oRoot && oRoot != null ? oRoot : o;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX = typeof minX != 'undefined' ? minX : null;
		o.minY = typeof minY != 'undefined' ? minY : null;
		o.maxX = typeof maxX != 'undefined' ? maxX : null;
		o.maxY = typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart = new Function();
		o.root.onDragEnd = new Function();
		o.root.onDrag = new Function();
		},
	start : function(e) {
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);

		o.lastMouseX = e.clientX;
		o.lastMouseY = e.clientY;

		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove = Drag.drag;
		document.onmouseup = Drag.end;
		return false;
		},
	drag : function(e) {
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey = e.clientY;
		var ex = e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper) nx = o.xMapper(y);
		else if (o.yMapper)	ny = o.yMapper(x);

		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;
		Drag.obj.root.onDrag(nx, ny);
		return false;
		},
	end : function() {
		document.onmousemove = null;
		document.onmouseup   = null;
		/*Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
								parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));*/
		Drag.obj.root.onDragEnd("L");		
		Drag.obj = null;
		},
	fixE : function(e) {
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
		}
	};

va = new VirtualAgent(); va.init();

