
function LiveChatInvite(config)
{this.httpp=(window.location.protocol.indexOf('https')!=-1)?'https://':'http://';this.INVITATION_NONE=0;this.INVITATION_STANDARD=1;this.INVITATION_AUTO=2;this.INVITATION_PERSONAL=3;this.current_invitation=this.INVITATION_NONE;this.$invitation_layer=false;this.$invitation_image=false;this.$overlay=false;this.conf=config;this.invitation_layer_id='lc_invite_layer';this.private_invite_script_id='LC_Private_Invite';this.auto_invite_script_id='LC_Auto_Invite';this.invite_layer='lc_invite_layer';this.quirks_mode_interval=false;this.is_in_quirks_mode=undefined;this.lc_controlImage;this.lc_timerID;this.lc_timerID_wait;this.ie6=false;var ua=window.navigator.userAgent,ie=ua.indexOf("MSIE ");this.ie6=((ie>0)?parseInt(ua.substring(ie+5,ua.indexOf(".",ie)))<=6:0);this.lc_MC=0;this.lc_Z=1;this.lc_W=0;this.lc_I=0;this.lc_R=5000;this.conf.overlay.id='lc_overlay_layer';this.standard_invite_html='<div style="position:relative">';this.standard_invite_html+='<a style="display:block;position:absolute;top:0;right:0;width:70px;height:25px;cursor:pointer;background:url('+this.httpp+this.conf.serv+'/server/images/pixel.gif)" href="javascript:void(0)" onclick="LC_Invite.lc_popup_close()"></a>';this.standard_invite_html+='<a href="javascript:void(0)" onclick="LC_Invite.lc_open_chat()" style="display:block;cursor:pointer;"><img src="'+this.httpp+'server.livechatinc.net'+'/licence/1004135/gfx/invite_en.gif" id="lc_standard_invitation_img" border="0" alt="" style="display:block"></a>';this.standard_invite_html+='</div>';this.init=function()
{this.prepare_elements();this.ping();};this.prepare_elements=function()
{var body=document.getElementsByTagName('body')[0],e,es;e=document.createElement('div');e.setAttribute('id',this.invitation_layer_id);this.$invitation_layer=e;es=this.$invitation_layer.style;es.display='none';es.zIndex=16777262;body.appendChild(this.$invitation_layer);var e=document.createElement('div');e.setAttribute('id',this.conf.overlay.id);this.$overlay=e;es=this.$overlay.style;es.backgroundColor=this.conf.overlay.color;es.position='fixed';es.left=0;es.top=0;es.zIndex=16777261;es.display='none';es.width='100%';es.height='100%';body.appendChild(this.$overlay);};this.gRequest=function()
{if(/^UA-/.test(this.conf.analytics_id)==false)return false;var ga_version=false;if(typeof window._gat=='object')ga_version='ga.js';else if(typeof window.urchinTracker=='function')ga_version='urchin.js';if(!ga_version)return false;var path='/LiveChat/Invitation/';if(this.current_invitation==this.INVITATION_STANDARD)
{path+='Standard';}
else if(this.current_invitation==this.INVITATION_PERSONAL)
{path+='Personal';}
else if(this.current_invitation==this.INVITATION_AUTO)
{path+='Auto';}
path+='/';switch(ga_version)
{case'ga.js':var pageTracker=window._gat._getTracker(this.conf.analytics_id);pageTracker._setDomainName('none');pageTracker._setAllowLinker(true);pageTracker._trackPageview(path);break;case'urchin.js':_uacct=this.conf.analytics_id;_udn="none";_ulink=1;try{urchinTracker(path);__utmSetVar(path);}
catch(e){};break;}};this.ping=function()
{if(this.lc_timerID){clearTimeout(this.lc_timerID);}
if(this.lc_timerID_wait){clearTimeout(this.lc_timerID_wait);}
this.lc_controlImage=new Image;pageDate=new Date;currTime=pageDate.getTime();u=this.httpp+this.conf.serv+'/licence/'+this.conf.lic+'/control.cgi';u=u+'?'+currTime;u=u+'&'+this.conf.lc.session;if(this.lc_MC==0)
{u=u+'&'+this.conf.hostname;u=u+'&'+encodeURIComponent(document.location);if(document.referrer==''){u=u+'&$';}else{u=u+'&'+encodeURIComponent(document.referrer);}
u+='&'+this.conf.lc.last_visit;u+='&'+this.conf.lic;u+='&'+encodeURIComponent(this.conf.nick);u+='&'+this.conf.lc.page_view;u+='&'+this.conf.lc.visit_number;u+='&'+this.conf.lc.chat_number;u+='&'+this.conf.lc.all_invitation;u+='&'+this.conf.lc.ok_invitation;u+='&'+this.conf.lc.last_operator_id;u+='&'+this.conf.lc.client_version;u+='&'+this.conf.lc.params;if(document.title==''){u=u+'&$';}else{u=u+'&'+encodeURIComponent(document.title);}
u=u+'&'+this.conf.lc.groups;}
this.lc_MC++;this.lc_controlImage.src=u;this.lc_timerID=setTimeout('LC_Invite.ping()',this.lc_R);this.lc_timerID_wait=setTimeout('LC_Invite.lc_after_send()',500);};this.lc_after_send=function()
{if(this.lc_timerID_wait)
{clearTimeout(this.lc_timerID_wait);}
if(this.lc_controlImage.complete==true)
{var w=this.lc_controlImage.width;if(w==24||w==33||w==34||w==36)
{if(this.lc_I==0&&this.lc_Z==1)
{if(this.conf.quickchat)
{window.open(httpp+'server.livechatinc.net/licence/1004135/open_chat.cgi?invite=1&lang=en&groups=0'+'&dc='+encodeURIComponent(document.cookie+';l='+document.location+';r='+document.referer+';s='+typeof lc_session),'chat_'+this.conf.lic,'width=529,height=520,resizable=yes,scrollbars=no,status='+this.conf.status);}
else if(w==34)
{this.load_personal_invitation();}
else if(w==36)
{this.load_auto_invitation();}
else
{this.load_standard_invitation();}}
else
{if(this.lc_I==0&&this.lc_W==0)
{this.lc_Z=1;}}}
else if(w==35)
{this.lc_MC=0;}
else if((w>=128)&&(w<255))
{this.lc_R=(w-127)*1000;}
else if(w==255)
{if(this.lc_timerID)
{clearTimeout(this.lc_timerID);}
if(this.lc_timerID_wait)
{clearTimeout(this.lc_timerID_wait);}}
else
{this.lc_W=0;this.lc_Z=1;}
if(this.lc_I>0)
{this.lc_I--;}}
else
{this.lc_timerID_wait=setTimeout('LC_Invite.lc_after_send()',500);}};this.check_if_invitation_allowed=function(type)
{if(type>this.current_invitation||(type==this.current_invitation&&type!=this.INVITATION_STANDARD))
{return true;}
return false;};this.load_standard_invitation=function()
{if(this.check_if_invitation_allowed(this.INVITATION_STANDARD)==false)
{return false;}
this.current_invitation=this.INVITATION_STANDARD;this.gRequest();this.display_invitation(this.standard_invite_html,this.conf.position);};this.load_personal_invitation=function()
{if(this.check_if_invitation_allowed(this.INVITATION_PERSONAL)==false)
{return false;}
this.current_invitation=this.INVITATION_PERSONAL;this.gRequest();var httpp=this.httpp;var head=document.getElementsByTagName('head')[0];script=document.createElement('script');script.id=this.private_invite_script_id;script.type='text/javascript';script.src=httpp+this.conf.serv+"/invite.cgi?status="+this.conf.status+"&licence="+this.conf.lic+"&lang="+this.conf.lang+"&skill="+this.conf.lc.groups+"&sess="+this.conf.lc.session+"&base_url="+httpp+this.conf.serv+"&redirect="+encodeURIComponent(httpp+'server.livechatinc.net/licence/1004135/open_chat.cgi?invite=1&lang=en&groups=0')+"&rand="+Math.floor(Math.random()*1000);head.appendChild(script);};this.load_auto_invitation=function()
{if(this.check_if_invitation_allowed(this.INVITATION_AUTO)==false)
{return false;}
this.current_invitation=this.INVITATION_AUTO;this.gRequest();var httpp=this.httpp;var head=document.getElementsByTagName('head')[0];script=document.createElement('script');script.id=this.auto_invite_script_id;script.type='text/javascript';script.src=httpp+this.conf.serv+"/invite_auto.cgi?sess="+this.conf.lc.session+"&rand="+Math.floor(Math.random()*1000);head.appendChild(script);};this.show_overlay_layer=function()
{this.$overlay.style.display='block';this.overlay_fade_in();};this.hide_overlay_layer=function()
{this.$overlay.style.display='none';};this.show_invitation_layer=function(id,pos)
{if(this.$invitation_image.complete==false)
{setTimeout(function()
{LC_Invite.show_invitation_layer(id,pos);},50);return false;}
if(pos.option=='left')
{pos.option='centered';pos.arg1=0;pos.arg2=0;}
this.conf.overlay.enabled=Boolean(pos.option=='centered');this.$invitation_layer.style.display='block';if(this.conf.overlay.enabled)
{this.$invitation_layer.style.marginLeft='-'+parseInt(this.$invitation_image.width/2)+'px';this.$invitation_layer.style.marginTop='-'+parseInt(this.$invitation_image.height/2)+'px';}
else
{this.$invitation_layer.style.marginLeft='0';this.$invitation_layer.style.marginTop='0';}
if(this.conf.overlay.enabled)
{this.show_overlay_layer();this.$invitation_layer.style.position='fixed';this.$invitation_layer.style.top='50%';this.$invitation_layer.style.left='50%';this.$invitation_layer.style.bottom='';}
else
{this.hide_overlay_layer();this.$invitation_layer.style.position='absolute';this.$invitation_layer.style.left='';this.$invitation_layer.style.top='';this.$invitation_layer.style.bottom='';}
if(this.conf.overlay.enabled&&(this.in_quirks_mode()||this.ie6))
{this.$invitation_layer.style.position='absolute';this.$overlay.style.position='absolute';this.$overlay.style.height=this.getClientHeight();this.$overlay.style.width=this.getClientWidth();if(this.quirks_mode_interval==false)
{this.quirks_mode_interval=setInterval(function()
{LC_Invite.$overlay.style.top=LC_Invite.getScrollTop();LC_Invite.$invitation_layer.style.marginTop=0;LC_Invite.$invitation_layer.style.top=LC_Invite.getScrollTop()+LC_Invite.getClientHeight()/2-LC_Invite.$invitation_image.height/2;},10);}}
else
{if(this.quirks_mode_interval!==false)
{clearInterval(this.quirks_mode_interval);}}
if(this.ie6)
{this.$invitation_image.parentNode.style.display="inline-block"
this.$invitation_image.parentNode.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.$invitation_image.src+"')";this.$invitation_image.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)";this.$invitation_layer.style.width=this.$invitation_image.width+'px';this.$invitation_layer.style.height=this.$invitation_image.height+'px';this.$invitation_layer.style.background='url('+this.httpp+this.conf.serv+'/server/images/pixel.gif)';}
if(this.conf.overlay.enabled)
{return false;}
var d=document;var de=d.documentElement;var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];var px=document.layers?"":"px";window[id+"_obj"]=el;if(d.layers)el.style=el;var that=this;el.cx=el.sx=pos.arg2;el.cy=el.sy=pos.arg1;el.sP=function(x,y)
{var bottom=-2*pos.arg1+LC_Invite.getClientHeight()-(that.$invitation_image.height);if(pos.option=='topLeft')
{this.style.left=x+px;this.style.top=y+px;}
else if(pos.option=='topRight')
{this.style.left=(that.getClientWidth()-that.$invitation_image.width-x)+px;this.style.top=y+px;}
else if(pos.option=='topCenter')
{this.style.top=y+px;this.style.left='50%';this.style.marginLeft=-parseInt(that.$invitation_image.width/2)+'px';}
else if(pos.option=='bottomRight')
{this.style.left=(that.getClientWidth()-that.$invitation_image.width-x)+px;this.style.top=y+bottom+px;}
else if(pos.option=='bottomLeft')
{this.style.top=y+bottom+px;this.style.left=x+px;}
else if(pos.option=='bottomCenter')
{this.style.top=y+bottom+px;this.style.left='50%';this.style.marginLeft=-parseInt(that.$invitation_image.width/2)+'px';}};el.floatIt=function()
{var pX,pY;pX=(this.sx>=0)?0:LC_Invite.getClientWidth();pY=LC_Invite.getScrollTop();if(this.sy<0)
{pY+=LC_Invite.getClientHeight();}
this.cx+=parseInt((pX+this.sx-this.cx)/8);this.cy+=parseInt((pY+this.sy-this.cy)/8);this.sP(this.cx,this.cy);that.floatItTimeout=setTimeout(this.id+"_obj.floatIt()",20);};el.floatIt();};this.lc_popup_hide=function()
{if(this.current_invitation==this.INVITATION_PERSONAL)
{this.remove_js(this.private_invite_script_id);}
else if(this.current_invitation==this.INVITATION_AUTO)
{this.remove_js(this.auto_invite_script_id);}
this.$invitation_layer.style.display='none';this.$overlay.style.display='none';clearTimeout(this.floatItTimeout);};this.lc_popup_close=function()
{this.lc_popup_hide();this.current_invitation=this.INVITATION_NONE;(new Image).src=this.httpp+this.conf.serv+'/tunnel.cgi?IWCS0014C^inviterefused^'+this.conf.lc.session+'^$^'+"&rand="+Math.floor(Math.random()*1000);};this.lc_open_chat=function()
{this.lc_popup_hide();window.open(decodeURIComponent(this.httpp+'server.livechatinc.net/licence/1004135/open_chat.cgi?invite=1&lang=en&groups=0')+'&dc='+encodeURIComponent(document.cookie+';l='+document.location+';r='+document.referer+';s='+typeof lc_session),'chat_'+this.conf.lic,'width=529,height=520,resizable=1,scrollbars=0,status=1');};this.in_quirks_mode=function()
{if(this.is_in_quirks_mode==undefined)
{this.is_in_quirks_mode=((window.navigator.userAgent.indexOf("MSIE ")>=0)&&document.compatMode&&document.compatMode=='BackCompat');}
return this.is_in_quirks_mode;};this.getPageSize=function()
{var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
return new Array(pageWidth,pageHeight,windowWidth,windowHeight)};this.getClientWidth=function()
{return this.getPageSize()[2];};this.getClientHeight=function()
{return this.getPageSize()[3];};this.getScrollTop=function()
{var yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;}else if(document.body){yScroll=document.body.scrollTop;}
return yScroll;};this.display_invitation=function(html,position)
{this.lc_popup_hide();this.conf.overlay.enabled=Boolean(position.option=='centered');this.$invitation_layer.innerHTML=html;var image_id;if(this.current_invitation==this.INVITATION_STANDARD)
{image_id='lc_standard_invitation_img';}
else if(this.current_invitation==this.INVITATION_PERSONAL)
{image_id='lc_personal_invitation_img';}
else if(this.current_invitation==this.INVITATION_AUTO)
{image_id='lc_auto_invitation_img';}
this.$invitation_image=document.getElementById(image_id);this.show_invitation_layer(this.invitation_layer_id,position);};this.remove_js=function(id)
{var alljs=document.getElementsByTagName("script");for(var i=alljs.length;i>=0;i--)
{if(alljs[i]&&alljs[i].getAttribute("id")!=null&&alljs[i].getAttribute("id").indexOf(id)!=-1)
{alljs[i].parentNode.removeChild(alljs[i]);}}};this.overlay_fade_in=function()
{var set_overlay_opacity=function(opacity)
{var s=LC_Invite.$overlay.style;s.opacity=s.MozOpacity=s.KhtmlOpacity=(opacity/100);s.filter='alpha(opacity='+opacity+')';}
set_overlay_opacity(0);var from=0;var to=parseInt(this.conf.overlay.opacity*100);var steps=Math.abs((to-from)/5);var step=1;var animate_opacity_change=function(step)
{if(step>steps)
{set_overlay_opacity(to);return;}
set_overlay_opacity(Math.ceil(from+(to-from)*(step/steps)));++step;setTimeout(function(){animate_opacity_change(step);},40);}
animate_opacity_change(step);};this.lc_popup_show=function()
{var invite_html=document.getElementById(LC_Invite.invite_layer).innerHTML;invite_html=invite_html.replace(/<\/div><img /i,'</div><span><img id="lc_personal_invitation_img" ');invite_html=invite_html.replace(/<\/div>$/i,'</span></div>');this.display_invitation(invite_html,this.conf.position);};this.lc_animate=function()
{};};function __addOnload(myfunc)
{if(document.readyState==='complete')
{return myfunc();}
if(window.addEventListener)
{window.addEventListener('load',myfunc,false);}
else if(window.attachEvent)
{window.attachEvent('onload',myfunc);}};var __lc_settings={position:{option:'left',arg1:50,arg2:250},overlay:{enabled:true,opacity:0.8,color:'#000'},lc:{last_visit:'1283447970',session:'S1283447970.015560ca5f',page_view:'1',visit_number:'1',chat_number:'0',all_invitation:'0',ok_invitation:'0',last_operator_id:'$',client_version:'$',params:'$',groups:'0'},lic:1004135,serv:'server.livechatinc.net',analytics_id:'661521',nick:'$',hostname:'$',quickchat:0,status:'1',invite_img_name:'/licence/1004135/gfx/invite_en.gif',lang:'en'};var LC_Invite=new LiveChatInvite(__lc_settings);__addOnload(function()
{LC_Invite.init();});