function getBrowser()
{
    var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    var re =/(msie|firefox|chrome|opera|version).*?([\d.]+)/;
    var m = ua.match(re);
    Sys.browser = m[1].replace(/version/, "safari");
    Sys.ver = m[2];
    return Sys;
}
var flypebrowser=getBrowser();
function getClientHeight(){
var xh=0;
if(document.documentElement&&document.documentElement.offsetHeight){
xh=document.documentElement.offsetHeight;
}else{
xh=document.body.offsetHeight;
}
    return xh;
}
function getScrollLeft(){
var xleft=0;
if(document.documentElement&&document.documentElement.scrollLeft){
xleft=document.documentElement.scrollLeft;
}else{
xleft=document.body.scrollLeft;
}

    return xleft;
}
function getScrollTop(){
var xtop=0;
if(document.documentElement&&document.documentElement.scrollTop){
xtop=document.documentElement.scrollTop;
}else{
xtop=document.body.scrollTop;
}

    return xtop;
}
function getClientWidth(){
var xw=0;
if(document.documentElement&&document.documentElement.offsetHeight){
xw=document.documentElement.offsetWidth;
}else{
xw=document.body.offsetWidth;
}
if(flypebrowser.browser=='msie') xw=xw-25;
return xw;
  
}
function G(x){
    return document.getElementById(x);
}
function flypemapOver(obj){
    obj.style.cursor="pointer";
}
function openChatForm() {
    flype_img_onclick();
    closeyqk();
}
function closetubiao()
{
    var pf=document.getElementById("iconpop");
    pf.style.visibility='hidden';
}
function closeyqk() {
    G("yqkdiv").style.visibility = 'hidden';
    try{
    //flype_refuseInvite();
    }catch(e){}
}
function flype_img_onclick(){
    try{
        var cook = document.cookie;
        if(cook.indexOf('checked=true')==-1)
        {
            setCookiefront("checked","true");
        }
    }catch(e){}
    window.open(sChatwinPath+"?CompanyID="+sCompanyID+"&Lang="+sLanguage,"","width=680,height=440,status=no,resizable=yes");
}

function initYqk()
{
    window.setTimeout(showYqk, parseInt(inviteTime)*1000);
}
function showYqk(){
    var yqk=G("yqkdiv");
    if(yqk){
    yqk.style.visibility = 'visible';
    flypeYqkScrolled();
     }else{
    window.setTimeout(showYqk, 500);
    }
}
//defalut yqk:w=396 h:176
function flypeYqkScrolled(){
    var yqk=G("yqkdiv");
    if(yqk.style.visibility != 'visible')return;
    var stop=getScrollTop();
     var sleft=getScrollLeft();
    if(inviteIsCenter){
        var cw=getClientWidth();
        //var ch=getClientHeight();
        var w=parseInt(cw/2);
        var sw=parseInt(inviteImgW/2);
        w=w-sw;
        //var h=parseInt(ch/2);
        //var sh=parseInt(inviteImgH/2);
        //h=h-sh;
        yqk.style.left=parseInt(sleft+w)+'px';
        yqk.style.top=parseInt(stop+200)+'px';
        //yqk.style.top=parseInt(stop+h)+'px';
  
    }else{
              
        yqk.style.left=parseInt(sleft+inviteX)+'px';
        yqk.style.top=parseInt(stop+inviteY)+'px';
    }
    window.setTimeout(flypeYqkScrolled, 500);
}
function initIconPop(){
    var icon=G("iconpop");
    if(icon){
    icon.style.visibility = 'visible';
    flypeIconScrolled();
    }else{
    window.setTimeout(initIconPop, 500);
    }
}
function flypeIconScrolled(){
    var icon=G("iconpop");
    //if(icon.style.visibility != 'visible')return;
    var sleft=getScrollLeft();
    var stop=getScrollTop();
    var cw=getClientWidth();
    if(popAlign==0){//left
        icon.style.left=parseInt(sleft+sidedis)+"px";
        icon.style.top=parseInt(stop+topdis)+"px";
    }else{//right
        icon.style.left=parseInt(cw-sidedis-iconW)+"px";
        icon.style.top=parseInt(stop+topdis)+"px";
    }
    window.setTimeout(flypeIconScrolled, 500);
}
function initListPop(){
    var listpop=G("listpop");
    if(listpop){
    listpop.style.visibility = 'visible';
    flypeListScrolled();
    }else{
    window.setTimeout(initListPop, 500);
    }
}
function flypeListScrolled(){
    var listpop=G("listpop");
    if(listpop.style.visibility!='visible')return;
    var sleft=getScrollLeft();
    var stop=getScrollTop();
    
    var listpopdivW=parseInt(listpop.clientWidth);
    if(popAlign==0){//left
        listpop.style.left=parseInt(sleft+sidedis)+"px";
        listpop.style.top=parseInt(stop+topdis)+"px";
    }else{//right
    	var cw=getClientWidth();
    	//alert("cw="+cw);
 		listpop.style.left=parseInt(cw-sidedis-listpopdivW+sleft)+"px";
       listpop.style.top=parseInt(stop+topdis)+"px";
    }
    window.setTimeout(flypeListScrolled, 500);
}
function flypecloseshow(x){
    var closediv=G("closediv");
    if(x==0){
        closediv.style.display="none";
    }else{
        closediv.style.display="inline";
    }
}
function flypeIconCloseShow(x)
{
	var closediv=G("iconcloseimg");
    if(x==0){
        closediv.style.display="none";
    }else{
        closediv.style.display="inline";
    }
}
function flypelistpopclose(){
    var listpop=G("listpop");
    listpop.style.display="none";
}
if(_initYqk){
initYqk();
}
if(_initListPop){
initListPop();
}else{
initIconPop();
}
if(_initpiwik){
initpiwik();
}


