//------cpItineraries---------------------------
cpItineraries = function(name,target){
	this.name=name;
	this.target=target;
	this.alpha=0;
	this.alpha2=0;
	this.status='off'; // off,on,fadein,fadeout
	this.timeout;
	this.itineraries=Array('The best of North & East Germany','The best of Romantic Germany','Rhine & Moselle River','Rhine, Main and Danube','Highlights of Denmark, Sweden and Norway','The best of Germany, Switzerland, Italy´s Lake District & Austria','A Royal Castle Tour','Christmas Markets in Germany','Grand Tour of charming Italy','The best of Germany´s Bavaria & Black Forest, Switzerland & Liechtenstein, Austria & its "Sound of Music Country"','Castles & Parks of Germany´s Brandenburg & Mecklenburg','Art & Culture Country Germany','Highlights of the German, Austrian & Swiss Alps','Religious Group Travel');
	this.ilinks=Array('The_best_of_North_and_East_Germany.html','The_best_of_Romantic_Germany.html','Rhine_and_Moselle_River.html','Rhine_Main_and_Danube.html','Highlights_of_Denmark_Sweden_and_Norway.html','The_best_of_Germany_Switzerland_Italys_Lake_District_and_Austria.html','A_Royal_Castle_Tour.html','Christmas_Markets_in_Germany.html','Grand_Tour_of_charming_Italy.html','The_best_of_Germanys_Bavaria_Black_Forest_Switzerland_and_Liechtenstein_Austria_and_its_Sound_of_Music_Country.html','Castles_and_Parks_of_Germanys_Brandenburg_and_Mecklenburg.html','Art_and_Culture_Country_Germany.html','Highlights_of_the_German_Austrian_and_Swiss_Alps.html','Religious_Group_Travel.html');
	this.autoscrolltop=0;

	this.init=function(){
		this.bgdiv=document.createElement("div");
		this.bgdiv.style.width='910px';
		this.bgdiv.style.height='350px';
		this.bgdiv.style.position='absolute';
		this.bgdiv.style.display='none';
		this.bgdiv.style.top='177px';
		this.bgdiv.style.left='35px';
		this.bgdiv.style.MsFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity="+this.alpha+")";
		this.bgdiv.style.filter = "alpha(opacity:"+this.alpha+")";
		this.bgdiv.style.KHTMLOpacity = this.bgdiv.style.MozOpacity = this.bgdiv.style.opacity = this.alpha/100;		
		var self=this;
		document.getElementById('body').appendChild(this.bgdiv);
		document.getElementById(target).href='javascript:cpItinerariesItem[\''+self.name+'\'].fade();';
	}

	this.setStart=function(start){
		this.start=start;
		var tmps='';
		tmps+='<img src="pics/itineraries.png" style="-ms-filter: &quot;progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)&quot;; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);" />';
		tmps+='<a href="'+this.ilinks[0]+'" id="'+this.name+'_img" style="cursor:pointer; background:url(\'pics/tn1b.jpg\');display:block; height:314px; width:504px;position:absolute; top:25px;left:380px;"></a>';
		tmps+='<div id="'+this.name+'_bg" onMousemove="cpItinerariesItem[\''+this.name+'\'].autoscroll(event);" style="display:block; height:326px; width:342px; overflow:hidden; position:absolute; top:18px; left:5px; border-right:1px solid #eb8a00; ">';
		tmps+='<div id="'+this.name+'_bgi" style="display:block; width:342px; position:absolute; top:0px; ">';
		for(var i=0; i<this.itineraries.length;i++) { tmps+='<img onClick="location.href=\''+this.ilinks[i]+'\';" onMouseover="cpItinerariesItem[\''+this.name+'\'].setImage('+(i+1)+');" id="'+this.name+'_item'+i+'" src="pics/tn'+(i+1)+'a.jpg" style="cursor:pointer;float:left; margin:5px 5px 5px 5px;" />'; }
		tmps+='</div>';
		tmps+='</div>';
		tmps+='<div onClick="cpItinerariesItem[\''+this.name+'\'].fade();" style="display:block; height:29px; width:29px; position:absolute; top:13px; left:881px; background:url(\'pics/close.png\'); cursor:pointer;"></div>';
		this.bgdiv.innerHTML=tmps;
		var autoscrollobj=document.getElementById(this.name+'_bg');
		this.autoscrolltop=autoscrollobj.offsetTop;
		while(autoscrollobj=autoscrollobj.offsetParent) this.autoscrolltop+=autoscrollobj.offsetTop;
	}

	this.autoscroll=function(e){
		var pos = (e.clientY+Math.max(document.documentElement.scrollTop,document.body.scrollTop))-this.autoscrolltop - 20;
		var height = 325-40;
		var height2 = Math.ceil(this.itineraries.length/2) * 109 - height;
		var target=document.getElementById(this.name+'_bgi');
		target.style.top= -( height2 * pos / height ) +'px';
	}

	this.setImage=function(i){
		var obj=document.getElementById(this.name+'_img');
		this.alpha2=0;
		obj.style.MsFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity="+this.alpha2+")";
		obj.style.filter = "alpha(opacity:"+this.alpha2+")";
		obj.style.KHTMLOpacity = obj.style.MozOpacity = obj.style.opacity = this.alpha2/100;
		obj.style.background='url(\'pics/tn'+i+'b.jpg\')';
		obj.href=this.ilinks[i-1];
		this.fadeIn2();
	}

	this.fadeIn2=function(){
		var obj=document.getElementById(this.name+'_img');
		this.alpha2=Math.min(this.alpha2+10,100);
		obj.style.MsFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity="+this.alpha2+")";
		obj.style.filter = "alpha(opacity:"+this.alpha2+")";
		obj.style.KHTMLOpacity = obj.style.MozOpacity = obj.style.opacity = this.alpha2/100;
		if(this.alpha2<100) {
			this.timeout=setTimeout('cpItinerariesItem[\''+this.name+'\'].fadeIn2()',30);
		}
	}


	this.fade=function(){
		clearTimeout(this.timeout);
		if(this.status=='off' || this.status=='fadeout') {
			this.bgdiv.innerHTML='<img src="pics/itineraries.png" style="-ms-filter: &quot;progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)&quot;; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);" />'
			this.alpha2=0;
			this.fadeIn();
		} else {
			this.fadeOut();
		}
	}

	this.fadeIn=function(){
		this.status='fadein';
		this.bgdiv.style.display='block';
		this.alpha=Math.min(this.alpha+10,100);
		this.bgdiv.style.MsFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity="+this.alpha+")";
		this.bgdiv.style.filter = "alpha(opacity:"+this.alpha+")";
		this.bgdiv.style.KHTMLOpacity = this.bgdiv.style.MozOpacity = this.bgdiv.style.opacity = this.alpha/100;
		if(this.alpha<100) {
			this.timeout=setTimeout('cpItinerariesItem[\''+this.name+'\'].fadeIn()',30);
		} else this.setStart(0);
	}

	this.fadeOut=function(){
		this.bgdiv.innerHTML='<img src="pics/itineraries.png" style="-ms-filter: &quot;progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)&quot;; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);" />';
		this.status='fadeout';
		this.alpha=Math.max(this.alpha-10,0);
		this.bgdiv.style.MsFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity="+this.alpha+")";
		this.bgdiv.style.filter = "alpha(opacity:"+this.alpha+")";
		this.bgdiv.style.KHTMLOpacity = this.bgdiv.style.MozOpacity = this.bgdiv.style.opacity = this.alpha/100;
		if(this.alpha>0) {
			this.timeout=setTimeout('cpItinerariesItem[\''+this.name+'\'].fadeOut()',30);
		} else this.bgdiv.style.display='none';
	}

	this.init();
}

var cpItinerariesItem=Array();

function addcpItineraries(id,target){
	if(cpItinerariesItem[id]==null) {
		cpItinerariesItem[id]=new cpItineraries(id,target);
	}
}

