//------cpLang---------------------------
cpLang = function(name,lang){
	this.name=name;
	this.lang=lang;
	this.languages=Array('English','Chinese','Japanese','Korean','Spanish');
	this.langImages=Array('pics/english.jpg','pics/chinese.jpg','pics/japanese.jpg','pics/korean.jpg','pics/spanish.jpg');
	this.langLinks=Array('http://www.irro-incoming.com','http://cn.irro-travel-services.com','http://jp.irro-travel-services.com','http://kr.irro-travel-services.com','http://es.irro-travel-services.com');
	this.top=-((this.languages.length-1)*41)+6;
	this.timeoutY=null;

	this.init=function(){
		this.bgdiv=document.createElement("div");
		this.bgdiv.style.width='163px';
		this.bgdiv.style.height=this.languages.length*41+'px';
		this.bgdiv.style.position='absolute';
		this.bgdiv.style.top=this.top+'px';
		this.bgdiv.style.left='600px';
		this.bgdiv.style.padding='0px 0px 0px 7px';
		this.bgdiv.style.cursor='pointer';
		this.bgdiv.style.zIndex='108';
		this.bgdiv.style.background='url(\'pics/language.png\')';
		this.bgdiv.style.backgroundPosition='bottom';
		this.bgdiv.innerHTML='';
		for(var i=0; i<this.languages.length; i++) if(i!=this.lang) this.bgdiv.innerHTML+='<a href="'+this.langLinks[i]+'"><img src="'+this.langImages[i]+'" /></a><br />';
		this.bgdiv.innerHTML+='<a href="'+this.langLinks[this.lang]+'"><img src="'+this.langImages[this.lang]+'" /></a><br />';
		document.getElementById('body').appendChild(this.bgdiv);
		var self=this;
		if (document.addEventListener) {
			this.bgdiv.addEventListener("mouseover", function(e) { clearTimeout(self.timeoutY); self.timeoutY=setTimeout('cpLangItem[\''+self.name+'\'].scrollIn(0)',30); }, true );
			this.bgdiv.addEventListener("mouseout", function(e) { clearTimeout(self.timeoutY); self.timeoutY=setTimeout('cpLangItem[\''+self.name+'\'].scrollOut(0)',30); }, true );
		} else {
			this.bgdiv.attachEvent("onmouseover", function(e) { clearTimeout(self.timeoutY); self.timeoutY=setTimeout('cpLangItem[\''+self.name+'\'].scrollIn(0)',30); }, true );
			this.bgdiv.attachEvent("onmouseout", function(e) { clearTimeout(self.timeoutY); self.timeoutY=setTimeout('cpLangItem[\''+self.name+'\'].scrollOut(0)',30); }, true );
		}

	}

	this.scrollIn=function(i){
		//this.top=Math.min(0,this.top+10);
		this.top=0.85*this.top;
		this.bgdiv.style.top=this.top+'px';
		if(this.top<0) {
			clearTimeout(this.timeoutY);
			this.timeoutY=setTimeout('cpLangItem[\''+this.name+'\'].scrollIn('+i+')',30);
		}
	}

	this.scrollOut=function(i){
		//this.top=Math.max(-((this.languages.length-1)*41)+6,this.top-10);
		this.top=0.85*this.top + 0.15*(-((this.languages.length-1)*41)+6);
		this.bgdiv.style.top=this.top+'px';
		if(this.top>-((this.languages.length-1)*41)+6) {
			clearTimeout(this.timeoutY);
			this.timeoutY=setTimeout('cpLangItem[\''+this.name+'\'].scrollOut('+i+')',30);
		}
	}
	this.init();
}

var cpLangItem=Array();

function addcpLang(id,lang){
	if(cpLangItem[id]==null) {
		cpLangItem[id]=new cpLang(id,lang);
	}
}

