﻿var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var pubUserId="";
var pubRealName="";
var pubProId="";
var pubAccount="";
var pubBranchId="";
var pubBranchName="";
var pubHostIp="";
var pubTyuserId="";
var pubEmployeeId="";
/**********曾锦加入判断浏览器版本**********************/
var Sys = {}; 
var ua = navigator.userAgent.toLowerCase(); 
if (window.ActiveXObject) 
Sys.ie = ua.match(/msie ([\d.]+)/)[1] 
else if (document.getBoxObjectFor) 
Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1] 
else if (window.MessageEvent && !document.getBoxObjectFor) 
Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1] 
else if (window.opera) 
Sys.opera = ua.match(/opera.([\d.]+)/)[1] 
else if (window.openDatabase) 
Sys.safari = ua.match(/version\/([\d.]+)/)[1]; 

function myFlash_DoFSCommand(command, args)                {
  var myFlashObj = InternetExplorer ? myFlash : document.myFlash;
  if(args.length==0){alert("请输入搜索内容！");return ;}
  window.open("/qn_search/cxzl_ss.jsp?searchWord="+encodeURI(args));
  return ;
  
}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('Sub myFlash_FSCommand(ByVal command, ByVal args)\n');
  document.write(' call myFlash_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write('</SCRIPT\> \n');
}

function openHelp() {
	 window.open('/help/index.jsp');
    return ;
}

function openTrade() {
    window.open('https://trade.gtja.com/');
    return ;
}
document.writeln("<div id=\"et\"  style=\"Z-INDEX:888888; WIDTH:300px;POSITION:absolute;TOP:0px; HEIGHT:140px;right:0;\">");
document.writeln("<OBJECT   classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" ");
document.writeln("WIDTH=\"300\" HEIGHT=\"140\" id=\"myFlash\">");
document.writeln("<PARAM NAME=movie VALUE=\"/js/et_new.swf\"><param name=\"quality\" value=\"high\"><param name=\"wmode\" value=\"transparent\"> ");
document.writeln("<EMBED src=\"/js/et_new.swf\" quality=high   WIDTH=\"300\" HEIGHT=\"140\" NAME=\"myFlash\"  TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\"></EMBED>");
document.writeln("</OBJECT></div>");
function moveR() {
 var et = document.getElementById("et");
et.style.top=document.documentElement.scrollTop+document.documentElement.clientHeight-140+"px"; 
et.style.left=document.documentElement.scrollLeft+document.documentElement.clientWidth-300+"px";

setTimeout("moveR();",50);
}
moveR();

var user_class = "1";//用户等级
var backParams; //flash返回参数
function openInvitation(obj) {
	backParams = obj;
	show();
}
 var re= getAll();
 initUser(re);    
function callExternalInterface() {

	var count = getCookie('count')==null?"":getCookie('count');
	user_class=re[7];
	thisMovie("myFlash").say(re[0],re[2],count,re[6],re[3],re[4],encodeURI(re[5]),'webcallzbwz',encodeURI(re[1]),user_class);
	
}
//浏览器兼容访问DOM
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	}
	else {
		return document[movieName]
	}
}
function accept1() {
	closeDialog();
	var url = "http://chat.gtja.com/webcall/client/client_index.jsp?param=null"+backParams;
	window.open(url,'_blank','height=549,width=681,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=no,status=no,top=100,left=200');
}
function encodeChange(sourceName) {
	return encodeURIComponent(sourceName);
}

function closeDialog()
		{
			document.getElementById("showDialog").style.visibility="hidden";
		}
function show()
		{
			document.getElementById("showDialog").style.visibility="visible";

		}
function initUser(reArray){

	pubUserId=reArray[0];
	pubRealName=reArray[1];
	pubProId=reArray[2];
	pubAccount=reArray[3];
	pubBranchId=reArray[4];
	pubBranchName=reArray[5];
	pubHostIp=reArray[6];
	pubTyuserId=reArray[8];
	pubEmployeeId=reArray[9];
}
//if(SysET.firefox) {ck=document.getElementById("ck").contentWindow;}
var result='';
function getUser(input){
	
	switch(input){
	 	case 'userId':
	 		result=pubUserId;
	 		break;
	 	case 'realName':
	 		result=pubRealName;
	 		break;	
	 	case 'proId':
	 		result=pubProId;
	 		break;	
	 	case 'account':
	 		result=pubAccount;
	 		break;	
	 	case 'branchId':
	 		result=pubBranchId;
	 		break;	
	 	case 'branchName':
	 		result=pubBranchName;
	 		break;	
	 	case 'hostIp':
	 		result=pubHostIp;
	 		break;	
	 	case 'tyuserId':
	 		result=pubTyuserId;
	 		break;					
	 	case 'employeeId':
	 		result=pubEmployeeId;
	 		break;	
	 }	
	 	return result;
}
var resultAll='';
function getUserAll(input){
	var url='/share/getAllUser.jsp';
	   var paras='';
	 	 new Ajax.Request(url,{method:'post',parameters:paras,asynchronous:false,onSuccess:function(request){
	 		resultAll=request.responseText;
	 		//alert(resultAll);
	 	},onFailure:function (){}});
	 	return resultAll;
}
function getAll(){
	var allresult=getUserAll('');
	var allreults=allresult.split("|");
	if(allreults.length>0) return allreults;
}
		
var pop;		
//投资咨询
function openInvestmentConsultation() {

var re= getAll();
var url="http://chat.gtja.com/webcall/client/et_wz_index.jsp?from=webcallzbwz&userId="+re[0]+"&realName="+encodeURI(re[1])+"&branchName="+encodeURI(re[5])+"&branchId="+re[4]+"&formenu=tzzx&account="+re[3]+"&provinceId="+re[2]+"&userClass="+re[7]+"&customer_code="+re[9];
	
		if(!pop || pop.closed)
			pop=window.open (url, 'newwindow', 'height=549, width=681, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no') ;
		else pop.focus();
}
//业务咨询
function openBusinessConsultation() {
var re= getAll();
var url="http://chat.gtja.com/webcall/client/et_wz_index.jsp?from=webcallzbwz&userId="+re[0]+"&realName="+encodeURI(re[1])+"&branchName="+encodeURI(re[5])+"&branchId="+re[4]+"&formenu=ywzx&account="+re[3]+"&provinceId="+re[2]+"&userClass="+re[7]+"&customer_code="+re[9];
	
	if(!pop || pop.closed)
		pop=window.open (url, 'newwindow', 'height=549, width=681, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no') ;
	else pop.focus();
}
//客户经理
function openCustomerManager() {
var re= getAll();
var url="http://chat.gtja.com/webcall/client/et_wz_index.jsp?from=webcallzbwz&userId="+re[0]+"&realName="+encodeURI(re[1])+"&branchName="+encodeURI(re[5])+"&branchId="+re[4]+"&formenu=khjl&account="+re[3]+"&provinceId="+re[2]+"&userClass="+re[7]+"&customer_code="+re[9];
	
	if(!pop || pop.closed)
		pop=window.open (url, 'newwindow', 'height=549, width=681, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no') ;
	else pop.focus();
}
//et助手帮助
function openETHelp() {
var re= getAll();
var url="http://chat.gtja.com/webcall/client/et_wz_index.jsp?from=webcallzbwz&userId="+re[0]+"&realName="+encodeURI(re[1])+"&branchName="+encodeURI(re[5])+"&branchId="+re[4]+"&formenu=help&account="+re[3]+"&provinceId="+re[2]+"&customer_code="+re[9];
		
		if(!pop || pop.closed)
		  pop=window.open (url, 'newwindow', 'height=549, width=681, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no') ;
		else pop.focus();
}
window.onload = function() {
	var count ;
	if(getCookie('count')!=null) count=getCookie('count');
	var today = new Date();
    var expires = new Date(today.getTime() + Cookie.year);
    //alert("open:"+count+"$");
	if(count==null) {
   		setCookie('count',1, expires,'/');
	}
	else {
		setCookie('count',++count, expires,'/');
	}
	//alert("open:"+getCookie('count'));
}
window.onunload = function() {
	var count ;
	if(getCookie('count')!=null) count=getCookie('count');
	var today = new Date();
    var expires = new Date(today.getTime() + Cookie.year);	
	if(count==1) {
		setCookie('count',0, expires,'/');
	}
	else {
		setCookie('count',--count, expires,'/');
	}
	//alert("closed:"+getCookie('count'));
}
//et助手同步登录
	function syn_wz_login(newUrl){
	    window.location = newUrl;
	}