/*
 * 功能：控制首页flash自动切换，菜单切换
 * 作者：曾锦
 */
var uid=-1;
var flashtmp = ["index_banner_1.swf", "index_banner_2.swf", "index_banner_3.swf"];
var ismove=1;// 控制是否自动运行 0代表不自动运行
function showMenu(index){

	for(var i=0;i<5;i++){
		var first=document.getElementsByName("first"+i);
		if(i==index){
			for(var j=0;j<first.length;j++){
				if(index==1 && parseInt(uid)<0)first[j].style.display='none';
				else first[j].style.display='';
			}
		}else{
			for(var j=0;j<first.length;j++){
				first[j].style.display='none';
			}
		}
	
	}
}

function clearMenu(index){
	var first=document.getElementsByName("first"+index);
		for(var i=0;i<first.length;i++){
		first[i].style.display='none';
	}
}

function reloadflash(index){
  var divName="flash";
  var imgId="flagimg";
	for(var i=0;i<4;i++){
		if(i==index) {
			document.getElementById(divName+i).style.display='';
			document.getElementById(imgId+i).src='/pic/index/index_gt_1.gif';
		}else{
			document.getElementById(divName+i).style.display='none';
			document.getElementById(imgId+i).src='/pic/index/index_gt_2.gif';
		}
	}
}
function ismoveMove(){
	ismove=0;
}
function ismoveOut(){
	ismove=1;
}
//随机改变数组的排序
function randomOrder (targetArray)
{
    var arrayLength = targetArray.length
    //
    //先创建一个正常顺序的数组
    var tempArray1 = new Array();

    for (var i = 0; i < arrayLength; i ++)
    {
        tempArray1 [i] = i
    }
    //
    //再根据上一个数组创建一个随机乱序的数组
    var tempArray2 = new Array();

    for (var i = 0; i < arrayLength; i ++)
    {
        //从正常顺序数组中随机抽出元素
        tempArray2 [i] = tempArray1.splice (Math.floor (Math.random () * tempArray1.length) , 1)
    }
    //
    //最后创建一个临时数组存储 根据上一个乱序的数组从targetArray中取得数据
    var tempArray3 = new Array();

    for (var i = 0; i < arrayLength; i ++)
    {
        tempArray3 [i] = targetArray [tempArray2 [i]]
    }
    //
    //返回最后得出的数组
    return tempArray3
}

var tmp=randomOrder(flashtmp);

function nDivS(){
	for(var i=0;i<tmp.length;i++){
		if(i==0)document.writeln("<div id=\"flash"+i+"\" onmouseover=\"ismoveMove();\" onmouseout=\"ismoveOut();\" >");
		else document.writeln("<div id=\"flash"+i+"\"  style=\"display:none;\" onmouseover=\"ismoveMove();\" onmouseout=\"ismoveOut();\" >");
		document.writeln("<script language=\"javascript\" type=\"text/javascript\">");
		document.writeln("writeflashhtml(\"_swf=/flash/"+tmp[i]+"\", \"_width=621\", \"_height=315\",\"_wmode=transparent\");");
		document.writeln("</script>");
		document.writeln("</div>");
	}
}
var flashtmpNew = ["index_banner_11.swf", "index_banner_12.swf", "index_banner_13.swf","index_banner_14.swf"];
var tmpNew=randomOrder(flashtmpNew);
function nDivSNew(){
	for(var i=0;i<tmpNew.length;i++){
		if(i==0)document.writeln("<div id=\"flash"+i+"\" onmouseover=\"ismoveMove();\" onmouseout=\"ismoveOut();\" >");
		else document.writeln("<div id=\"flash"+i+"\"  style=\"display:none;\" onmouseover=\"ismoveMove();\" onmouseout=\"ismoveOut();\" >");
		
			document.writeln("<script language=\"javascript\" type=\"text/javascript\">");
			document.writeln("writeflashhtml(\"_swf=/flash/"+tmpNew[i]+"\", \"_width=606\", \"_height=263\",\"_wmode=transparent\");");
			document.writeln("</script>");
		document.writeln("</div>");
	}
}

var num=0;

function selfflash(){
  if(ismove==1){
		reloadflash(num);
		num++;
		if(num>=3)num=0;
	}
}

 setInterval(selfflash,14000);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
		var vdomain="1" +document.domain + "2";
		if (vdomain.indexOf("admin.gtja.com")>0)
		window.location.href="http://admin.gtja.com/admin/login/login_cms.jsp";
		if (vdomain.indexOf("mobile.gtja.com")>0)
		window.location.href="http://mobile.gtja.com/yyz/index.html";
		else if (vdomain.indexOf("m.gtja.com")>0)
		window.location.href = "http://m.gtja.com/yyz/index.html";
		else if (vdomain.indexOf("gdsd.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/sddl/indexnew.html";
		else if (vdomain.indexOf("hb.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/hb/index.html";
		else if (vdomain.indexOf("sjzjh.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/hb/index.html";
		else if (vdomain.indexOf("www.9608008.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/hb/index.html";
		else if (vdomain.indexOf("sx.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/sx/index.html";
		else if (vdomain.indexOf("jl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/jl/index.html";
		else if (vdomain.indexOf("yn.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/yn/index.html";
		else if (vdomain.indexOf("shscl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/scl/index.html";
		else if (vdomain.indexOf("help.gtja.com")>0)
		window.location.href = "http://www.gtja.com/help/index.jsp";
		else if (vdomain.indexOf("shjsl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/jsl/index.html";
		else if (vdomain.indexOf("fj.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/fj/index.html";
		else if (vdomain.indexOf("jx.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/jx/index.html";
		else if (vdomain.indexOf("cq.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/cq/index.html";
		else if (vdomain.indexOf("gs.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/gs/index.html";
		else if (vdomain.indexOf("ln.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/ln/index.html";
		else if (vdomain.indexOf("zz.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/zz/index.html";
		else if (vdomain.indexOf("js.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/js/index.html";
		else if (vdomain.indexOf("www.gtjajs.com.cn")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/js/index.html";
		else if (vdomain.indexOf("hi.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/hi/index.html";
		else if (vdomain.indexOf("sd.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/sd/index.html";
		else if (vdomain.indexOf("cd.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/cd/index.html";
		else if (vdomain.indexOf("szytl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/szytl/index.html";
		else if (vdomain.indexOf("shwhl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/shwhl/index.html";
		else if (vdomain.indexOf("www.gtjazz.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/zz/index.html";
		else if (vdomain.indexOf("ah.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/ah/index.html";
		else if (vdomain.indexOf("e.gtja.com")>0)
		window.location.href = "http://marketing.gtja.com";
		else if (vdomain.indexOf("www.gtjacc.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/jl/index.html";
		else if (vdomain.indexOf("zj.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/zj/index.html";
		else if (vdomain.indexOf("nmg.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/nmg/index.html";
		else if (vdomain.indexOf("xa.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/xa/index.html";
		else if (vdomain.indexOf("www.xagtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/xa/index.html";
		else if (vdomain.indexOf("hn.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/hn/index.html";
		else if (vdomain.indexOf("xj.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/xj/index.html";
		else if (vdomain.indexOf("tj.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/tj/index.html";
		else if (vdomain.indexOf("gz.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/gz/index.html";
		else if (vdomain.indexOf("gx.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/gx/index.html";
		else if (vdomain.indexOf("hlj.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/hlj/index.html";
		else if (vdomain.indexOf("shypl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/shypl/index.html";
		else if (vdomain.indexOf("sh.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/sh/index.html";
		else if (vdomain.indexOf("shljz.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/shljz/index.html";
		else if (vdomain.indexOf("shspl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/shspl/index.html";
		else if (vdomain.indexOf("bj.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/bj/indexnew.html";
		else if (vdomain.indexOf("www.96299.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/jx/index.html";
		else if (vdomain.indexOf("gddg.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/dgtyl/indexnew.html";
		else if (vdomain.indexOf("szfhsl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/szfhsl/index.html";
		else if (vdomain.indexOf("gdst.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/stjsl/index.html";
		else if (vdomain.indexOf("shdpl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/shdpl/index.html";
		else if (vdomain.indexOf("szsbl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/szsbzl/index.html";
		else if (vdomain.indexOf("shmdj2.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/shmdj/index.html";
		else if (vdomain.indexOf("www.junhongclub.com")>0)
		window.location.href = "http://www.gtja.com/junhong/index.jsp";
		else if (vdomain.indexOf("www.junhongclub.cn")>0)
		window.location.href = "http://www.gtja.com/junhong/index.jsp";
		else if (vdomain.indexOf("www.xn--sqrq9w.com")>0)
		window.location.href = "http://www.gtja.com/junhong/index.jsp";
		else if (vdomain.indexOf("wwws.gtja.com")>0)
		window.location.href = "http://www.gtja.com";
		else if (vdomain.indexOf("szzhl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/szzhl/index.html";
		else if (vdomain.indexOf("szhqbl.gtja.com")>0)
		window.location.href = "http://www.gtja.com/gtjafzjg/szzhl/index.html";
