﻿//首页banner
function writeflashhtml( arg )
{
var parm = []
var _default_version = "8,0,24,0";
var _default_quality = "high";
var _default_align = "middle";
var _default_menu = "false";

for(i = 0; i < arguments.length; i ++)
{
parm[i] = arguments[i].split(' ').join('').split('=')
for (var j = parm[i].length-1; j > 1; j --){
parm[i][j-1]+="="+parm[i].pop();
}
switch (parm[i][0])
{
case '_version' : var _version = parm[i][1] ; break ; 
case '_swf' : var _swf = parm[i][1] ; break ; 
case '_base' : var _base = parm[i][1] ; break ; 
case '_quality' : var _quality = parm[i][1] ; break ; 
case '_loop' : var _loop = parm[i][1] ; break ; 
case '_bgcolor' : var _bgcolor = parm[i][1] ; break ; 
case '_wmode' : var _wmode = parm[i][1] ; break ; 
case '_play' : var _play = parm[i][1] ; break ; 
case '_menu' : var _menu = parm[i][1] ; break ; 
case '_scale' : var _scale = parm[i][1] ; break ; 
case '_salign' : var _salign = parm[i][1] ; break ; 
case '_height' : var _height = parm[i][1] ; break ; 
case '_width' : var _width = parm[i][1] ; break ; 
case '_hspace' : var _hspace = parm[i][1] ; break ; 
case '_vspace' : var _vspace = parm[i][1] ; break ; 
case '_align' : var _align = parm[i][1] ; break ; 
case '_class' : var _class = parm[i][1] ; break ; 
case '_id' : var _id = parm[i][1] ; break ; 
case '_name' : var _name = parm[i][1] ; break ; 
case '_style' : var _style = parm[i][1] ; break ; 
case '_declare' : var _declare = parm[i][1] ; break ; 
case '_flashvars' : var _flashvars = parm[i][1] ; break ; 
default :;
}
}
var thtml = ""
thtml += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + ((_version)?_version:_default_version) + "'"
if(_width) thtml += " width='" + _width + "'"
if(_height) thtml += " height='" + _height + "'"
if(_hspace) thtml += " hspace='" + _hspace + "'"
if(_vspace) thtml += " vspace='" + _vspace + "'"
if(_align) thtml += " align='" + _align + "'"
else thtml += " align='" + _default_align + "'"
if(_class) thtml += " class='" + _class + "'"
if(_id) thtml += " id='" + _id + "'"
if(_name) thtml += " name='" + _name + "'"
if(_style) thtml += " style='" + _style + "'"
if(_declare) thtml += " " + _declare
thtml += ">"
if(_swf) thtml += "<param name='movie' value='" + _swf + "'>"
if(_quality) thtml += "<param name='quality' value='" + _quality + "'>" 
else thtml += "<param name='quality' value ='" + _default_quality + "'>"
if(_loop) thtml += "<param name='loop' value='" + _loop + "'>"
if(_bgcolor) thtml += "<param name='bgcolor' value='" + _bgcolor + "'>"
if(_play) thtml += "<param name='play' value='" + _play + "'>"
if(_menu) thtml += "<param name='menu' value='" + _menu + "'>"
else thtml += "<param name='menu' value='" + _default_menu + "'>"
if(_scale) thtml += "<param name='scale' value='" + _scale + "'>"
if(_salign) thtml += "<param name='salign' value='" + _salign + "'>"
if(_wmode) thtml += "<param name='wmode' value='" + _wmode + "'>"
if(_base) thtml += "<param name='base' value='" + _base + "'>"
if(_flashvars) thtml += "<param name='flashvars' value='" + _flashvars + "'>"
thtml += "<embed pluginspage='http://www.macromedia.com/go/getflashplayer'"
if(_width) thtml += " width='" + _width + "'"
if(_height) thtml += " height='" + _height + "'"
if(_hspace) thtml += " hspace='" + _hspace + "'"
if(_vspace) thtml += " vspace='" + _vspace + "'"
if(_align) thtml += " align='" + _align + "'"
else thtml += " align='" + _default_align + "'"
if(_class) thtml += " class='" + _class + "'"
if(_id) thtml += " id='" + _id + "'"
if(_name) thtml += " name='" + _name + "'"
if(_style) thtml += " style='" + _style + "'"
thtml += " type='application/x-shockwave-flash'"
if(_declare) thtml += " " + _declare 
if(_swf) thtml += " src='" + _swf + "'"
if(_quality) thtml += " quality='" + _quality + "'"
else thtml += " quality='" + _default_quality + "'"
if(_loop) thtml += " loop='" + _loop + "'"
if(_bgcolor) thtml += " bgcolor='" + _bgcolor + "'"
if(_play) thtml += " play='" + _play + "'"
if(_menu) thtml += " menu='" + _menu + "'"
else thtml += " menu='" + _default_menu + "'"
if(_scale) thtml += " scale='" + _scale + "'"
if(_salign) thtml += " salign='" + _salign + "'"
if(_wmode) thtml += " wmode='" + _wmode + "'"
if(_base) thtml += " base='" + _base + "'"
if(_flashvars) thtml += " flashvars='" + _flashvars + "'"
thtml += "></embed>"
thtml += "</object>"
document.write(thtml)
}



/*大韩动态和媒体报道切换*/
        function show_con_1(){
            document.getElementById("con_1").style.display="";
            document.getElementById("a_over1").className="chk";
            document.getElementById("con_2").style.display="none";
            document.getElementById("a_over2").className="";
        }
        
        function show_con_2(){
            document.getElementById("con_1").style.display="none";
            document.getElementById("a_over1").className="";
            document.getElementById("con_2").style.display="";
            document.getElementById("a_over2").className="chk";
        }
		
// 导航切换

function closetalkwin()
{document.getElementById("TC").style.display="none";document.getElementById("TCR1").style.display="block";}
function closetalkwin2()
{document.getElementById("TCR1").style.display="none";}
function listshow()
{document.getElementById("TCR1").style.height='340px';document.getElementById("listshow").style.display='block';}
function listhidden()
{document.getElementById("TCR1").style.height='140px';document.getElementById("listshow").style.display='none';}
function setTab(name,cursel,n){for(i=1;i<=n;i++){var menu=document.getElementById(name+i);var con=document.getElementById("con_"+name+"_"+i);menu.className=i==cursel?"hover":"";con.style.display=i==cursel?"block":"none";}}
		
//乘车路线品牌中心

function xiaTab(m,n)
{
	
	var tli=document.getElementById("menu"+m).getElementsByTagName("li");
	var mli=document.getElementById("main"+m).getElementsByTagName("ul");
	var url=document.getElementById("url"+m);
	
	for(i=0;i<tli.length;i++){
		tli[i].className=i==n?"hover":"";
		mli[i].style.display=i==n?"block":"none";
		if(i==n){
		url.href = tli[i].id;
		}
	}
	
}

function showDiv(obj,num,len)
{
	for(var id = 1;id<=len;id++)
	{
		var ss=obj+id;
		var snav=obj+"nav"+id;
		var surl=obj+"url"+id;
		if(id==num){
			try{document.getElementById(ss).style.display="block"}catch(e){};
			try{document.getElementById(snav).className="hover"}catch(e){};
			try{document.getElementById(surl).style.display="inline"}catch(e){};
		}else{
			try{document.getElementById(ss).style.display="none"}catch(e){};
			try{document.getElementById(snav).className="moveout"}catch(e){};
			try{document.getElementById(surl).style.display="none"}catch(e){};
		}
	}
}


function $a(id,tag){var re=(id&&typeof id!="string")?id:document.getElementById(id);if(!tag){return re;}else{return re.getElementsByTagName(tag);}}
function addImg(url){var img=new Image();img.src=url;return img;}

function HtmlMove(id,tag,path,rate,upbt,downbt,pgtime,lis)
{
	var mous=false,o=$a(id);o.onmouseover=function(){mous=true;};o.onmouseout=function(){mous=false;};
	var fg=tag.split('/'),as=$a(o,fg[1]),fx=(path=="scrollRight"||path=="scrollLeft")?"scrollLeft":"scrollTop";
	var ow=fx=="scrollTop"?as[0].offsetHeight:as[0].offsetWidth,pw=fx=="scrollTop"?o.offsetHeight:o.offsetWidth;
	var pgli=lis||Math.floor((pw+ow/2)/ow),pg=Math.floor((as.length+(pgli-1))/pgli),pgmx=ow*pgli,now=0,mx,d;
	var os=$a(o,fg[0])[0];os.innerHTML+=os.innerHTML;d=setInterval(function(){go_to((path=="scrollTop"||path=="scrollLeft")?true:false);},pgtime);
	if(upbt)
	{
		var ups=$a(upbt),uimg=addImg(ups.src),uimg1=addImg(ups.src.replace(/(.*)(\.\w{3})/,"$1_$2"));
		ups.onmouseover=function(){this.src=uimg1.src;};ups.onmouseout=function(){this.src=uimg.src;}
		$a(upbt).onmousedown=function(){clearInterval(d);go_to(true);d=setInterval(function(){go_to(true);},pgtime);}
	}
	if(downbt)
	{
		var down=$a(downbt),dimg=addImg(down.src),dimg1=addImg(down.src.replace(/(.*)(\.\w{3})/,"$1_$2"));
		down.onmouseover=function(){this.src=dimg1.src;};down.onmouseout=function(){this.src=dimg.src;}
		down.onmousedown=function(){clearInterval(d);go_to(false);d=setInterval(function(){go_to(false);},pgtime);}
	}
	function go_to(fxs){if(mous){return;};var ex;
	if(fxs){if(now<pg){now++;}else{now=1;o[fx]=0;}mx=now*pgmx;ex=setInterval(function(){(o[fx]+rate<mx)?(o[fx]+=rate):o[fx]=mx;if(o[fx]==mx){clearInterval(ex);}},15);}
	else{if(now>0){now--;}else{now=pg-1;o[fx]=pg*pgmx;}mx=now*pgmx;ex=setInterval(function(){(o[fx]-rate>mx)?(o[fx]-=rate):o[fx]=mx;if(o[fx]==mx){clearInterval(ex);}},15);}}
}

function changes(id,div_num,total)
{
for(i=1;i<=total;i++)
{
  if(i==id)
   {
	 document.getElementById("head"+div_num+"_"+i).className="show";
     document.getElementById("body"+div_num+"_"+i).style.display="";
   }
  else
   {
     document.getElementById("head"+div_num+"_"+i).className="on";
     document.getElementById("body"+div_num+"_"+i).style.display="none";
   }
}
}
//首页幻灯片
var $=function(id){return"string"==typeof id?document.getElementById(id):id};var Extend=function(destination,source){for(var property in source){destination[property]=source[property]};return destination};var CurrentStyle=function(element){return element.currentStyle||document.defaultView.getComputedStyle(element,null)};var Bind=function(object,fun){var args=Array.prototype.slice.call(arguments).slice(2);return function(){return fun.apply(object,args.concat(Array.prototype.slice.call(arguments)))}};var Tween={Quart:{easeOut:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b}},Back:{easeOut:function(t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b}},Bounce:{easeOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}}}};var SlideTrans=function(container,slider,count,options){this._slider=$(slider);this._container=$(container);this._timer=null;this._count=Math.abs(count);this._target=0;this._t=this._b=this._c=0;this.Index=0;this.SetOptions(options);this.Auto=!!this.options.Auto;this.Duration=Math.abs(this.options.Duration);this.Time=Math.abs(this.options.Time);this.Pause=Math.abs(this.options.Pause);this.Tween=this.options.Tween;this.onStart=this.options.onStart;this.onFinish=this.options.onFinish;var bVertical=!!this.options.Vertical;this._css=bVertical?"top":"left";var p=CurrentStyle(this._container).position;p=="relative"||p=="absolute"||(this._container.style.position="relative");this._container.style.overflow="hidden";this._slider.style.position="absolute";this.Change=this.options.Change?this.options.Change:this._slider[bVertical?"offsetHeight":"offsetWidth"]/this._count};SlideTrans.prototype={SetOptions:function(options){this.options={Vertical:true,Auto:true,Change:0,Duration:50,Time:10,Pause:4000,onStart:function(){},onFinish:function(){},Tween:Tween.Quart.easeOut};Extend(this.options,options||{})},Run:function(index){index==undefined&&(index=this.Index);index<0&&(index=this._count-1)||index>=this._count&&(index=0);this._target=-Math.abs(this.Change)*(this.Index=index);this._t=0;this._b=parseInt(CurrentStyle(this._slider)[this.options.Vertical?"top":"left"]);this._c=this._target-this._b;this.onStart();this.Move()},Move:function(){clearTimeout(this._timer);if(this._c&&this._t<this.Duration){this.MoveTo(Math.round(this.Tween(this._t++,this._b,this._c,this.Duration)));this._timer=setTimeout(Bind(this,this.Move),this.Time)}else{this.MoveTo(this._target);this.Auto&&(this._timer=setTimeout(Bind(this,this.Next),this.Pause))}},MoveTo:function(i){this._slider.style[this._css]=i+"px"},Next:function(){this.Run(++this.Index)},Previous:function(){this.Run(--this.Index)},Stop:function(){clearTimeout(this._timer);this.MoveTo(this._target)}};

//媒体报道
function Top10(list_id)
{
	var listid=document.getElementById(list_id);
	var li=listid.getElementsByTagName("li");
	var linum=li.length;
	for(i=0;i<linum;++i)
	{
		li[i].index=parseInt((i+1)/2+0.5);
		li[i].onmouseover=function(){
			for(j=1;j<=parseInt(linum/2);j++)
			{
				document.getElementById("pro_"+j+"_2").style.display="none";
			}
			document.getElementById("pro_"+this.index+"_2").style.display="";
		}
	}
}


//大韩动态
function Top11(list_id)
{
	var listid=document.getElementById(list_id);
	var li=listid.getElementsByTagName("li");
	var linum=li.length;
	for(i=0;i<linum;++i)
	{
		li[i].index=parseInt((i+1)/2+0.5);
		li[i].onmouseover=function(){
			for(j=1;j<=parseInt(linum/2);j++)
			{
				document.getElementById("pros_"+j+"_2").style.display="none";
			}
			document.getElementById("pros_"+this.index+"_2").style.display="";
		}
	}
}



//首页专家
// JavaScript Document
function H$(i) {return document.getElementById(i)}
function H$$(c, p) {return p.getElementsByTagName(c)}
var sliders = function () {
	function init (o) {
		this.id = o.id;
		this.at = o.auto ? o.auto : 3;
		this.o = 0;
		this.pos();
	}
	init.prototype = {
		pos : function () {
			clearInterval(this.__b);
			this.o = 0;
			var el = H$(this.id), li = H$$('li', el), l = li.length;
			var _t = li[l-1].offsetHeight;
			var cl = li[l-1].cloneNode(true);
			cl.style.opacity = 0; cl.style.filter = 'alpha(opacity=0)';
			el.insertBefore(cl, el.firstChild);
			el.style.top = -_t + 'px';
			this.anim();
		},
		anim : function () {
			var _this = this;
			this.__a = setInterval(function(){_this.animH()}, 20);
		},
		animH : function () {
			var _t = parseInt(H$(this.id).style.top), _this = this;
			if (_t >= -1) {
				clearInterval(this.__a);
				H$(this.id).style.top = 0;
				var list = H$$('li',H$(this.id));
				H$(this.id).removeChild(list[list.length-1]);
				this.__c = setInterval(function(){_this.animO()}, 20);
				//this.auto();
			}else {
				var __t = Math.abs(_t) - Math.ceil(Math.abs(_t)*.07);
				H$(this.id).style.top = -__t + 'px';
			}
		},
		animO : function () {
			this.o += 2;
			if (this.o == 100) {
				clearInterval(this.__c);
				H$$('li',H$(this.id))[0].style.opacity = 1;
				H$$('li',H$(this.id))[0].style.filter = 'alpha(opacity=100)';
				this.auto();
			}else {
				H$$('li',H$(this.id))[0].style.opacity = this.o/100;
				H$$('li',H$(this.id))[0].style.filter = 'alpha(opacity='+this.o+')';
			}
		},
		auto : function () {
			var _this = this;
			this.__b = setInterval(function(){_this.pos()}, this.at*1000);
		}
	}
	return init;
}();


//首页专题
function ZoomPic ()
{
	this.initialize.apply(this, arguments)	
}
ZoomPic.prototype = 
{
	initialize : function (id)
	{
		var _this = this;
		this.wrap = typeof id === "string" ? document.getElementById(id) : id;
		this.oUl = this.wrap.getElementsByTagName("ul")[0];
		this.aLi = this.wrap.getElementsByTagName("li");
		this.prev = this.wrap.getElementsByTagName("pre")[0];
		this.next = this.wrap.getElementsByTagName("pre")[1];
		this.timer = null;
		this.aSort = [];
		this.iCenter = 4;
		this._doPrev = function () {return _this.doPrev.apply(_this)};
		this._doNext = function () {return _this.doNext.apply(_this)};
		this.options = [
			{width:110, height:72, top:74, left:0, zIndex:1},			
			{width:120, height:91, top:55, left:80, zIndex:2},
			{width:130, height:111, top:35, left:180, zIndex:3},
			{width:170, height:126, top:20, left:280, zIndex:4},
			{width:224, height:146, top:0, left:390, zIndex:5},
			{width:170, height:126, top:20, left:550, zIndex:4},
			{width:130, height:111, top:35, left:670, zIndex:3},
			{width:120, height:91, top:55, left:761, zIndex:2},
			{width:110, height:72, top:74, left:852, zIndex:1}
		];
		for (var i = 0; i < this.aLi.length; i++) this.aSort[i] = this.aLi[i];
		this.aSort.unshift(this.aSort.pop());
		this.setUp();
		this.addEvent(this.prev, "click", this._doPrev);
		this.addEvent(this.next, "click", this._doNext);
		this.doImgClick();		
		this.timer = setInterval(function ()
		{
			_this.doNext()	
		}, 3000);		
		this.wrap.onmouseover = function ()
		{
			clearInterval(_this.timer)	
		};
		this.wrap.onmouseout = function ()
		{
			_this.timer = setInterval(function ()
			{
				_this.doNext()	
			}, 3000);	
		}
	},
	doPrev : function ()
	{
		this.aSort.unshift(this.aSort.pop());
		this.setUp()
	},
	doNext : function ()
	{
		this.aSort.push(this.aSort.shift());
		this.setUp()
	},
	doImgClick : function ()
	{
		var _this = this;
		for (var i = 0; i < this.aSort.length; i++)
		{
			this.aSort[i].onclick = function ()
			{
				if (this.index > _this.iCenter)
				{
					for (var i = 0; i < this.index - _this.iCenter; i++) _this.aSort.push(_this.aSort.shift());
					_this.setUp()
				}
				else if(this.index < _this.iCenter)
				{
					for (var i = 0; i < _this.iCenter - this.index; i++) _this.aSort.unshift(_this.aSort.pop());
					_this.setUp()
				}
			}
		}
	},
	setUp : function ()
	{
		var _this = this;
		var i = 0;
		for (i = 0; i < this.aSort.length; i++) this.oUl.appendChild(this.aSort[i]);
		for (i = 0; i < this.aSort.length; i++)
		{
			this.aSort[i].index = i;
			if (i < 9)
			{
				this.css(this.aSort[i], "display", "block");
				this.doMove(this.aSort[i], this.options[i], function ()
				{
					_this.doMove(_this.aSort[_this.iCenter].getElementsByTagName("img")[0], {opacity:100}, function ()
					{
						_this.doMove(_this.aSort[_this.iCenter].getElementsByTagName("img")[0], {opacity:100}, function ()
						{
							_this.aSort[_this.iCenter].onmouseover = function ()
							{
								_this.doMove(this.getElementsByTagName("div")[0], {bottom:0})
							};
							_this.aSort[_this.iCenter].onmouseout = function ()
							{
								_this.doMove(this.getElementsByTagName("div")[0], {bottom:-100})
							}
						})
					})
				});
			}
			else
			{
				this.css(this.aSort[i], "display", "none");
				this.css(this.aSort[i], "width", 0);
				this.css(this.aSort[i], "height", 0);
				this.css(this.aSort[i], "top", 37);
				this.css(this.aSort[i], "left", this.oUl.offsetWidth / 2)
			}
			if (i < this.iCenter || i > this.iCenter)
			{
				this.css(this.aSort[i].getElementsByTagName("img")[0], "opacity", 30)
				this.aSort[i].onmouseover = function ()
				{
					_this.doMove(this.getElementsByTagName("img")[0], {opacity:100})	
				};
				this.aSort[i].onmouseout = function ()
				{
					_this.doMove(this.getElementsByTagName("img")[0], {opacity:35})
				};
				this.aSort[i].onmouseout();
			}
			else
			{
				this.aSort[i].onmouseover = this.aSort[i].onmouseout = null
			}
		}		
	},
	addEvent : function (oElement, sEventType, fnHandler)
	{
		return oElement.addEventListener ? oElement.addEventListener(sEventType, fnHandler, false) : oElement.attachEvent("on" + sEventType, fnHandler)
	},
	css : function (oElement, attr, value)
	{
		if (arguments.length == 2)
		{
			return oElement.currentStyle ? oElement.currentStyle[attr] : getComputedStyle(oElement, null)[attr]
		}
		else if (arguments.length == 3)
		{
			switch (attr)
			{
				case "width":
				case "height":
				case "top":
				case "left":
				case "bottom":
					oElement.style[attr] = value + "px";
					break;
				case "opacity" :
					oElement.style.filter = "alpha(opacity=" + value + ")";
					oElement.style.opacity = value / 100;
					break;
				default :
					oElement.style[attr] = value;
					break
			}	
		}
	},
	doMove : function (oElement, oAttr, fnCallBack)
	{
		var _this = this;
		clearInterval(oElement.timer);
		oElement.timer = setInterval(function ()
		{
			var bStop = true;
			for (var property in oAttr)
			{
				var iCur = parseFloat(_this.css(oElement, property));
				property == "opacity" && (iCur = parseInt(iCur.toFixed(2) * 100));
				var iSpeed = (oAttr[property] - iCur) / 5;
				iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
				
				if (iCur != oAttr[property])
				{
					bStop = false;
					_this.css(oElement, property, iCur + iSpeed)
				}
			}
			if (bStop)
			{
				clearInterval(oElement.timer);
				fnCallBack && fnCallBack.apply(_this, arguments)	
			}
		}, 30)
	}
};
window.onload = function ()
{
	new ZoomPic("box");
};
