// machine dependent javascript-Library for opening the TTLine booking-dialogue
// version for ibe.ttline.com (LIVE)

function openCargoDialog(lang) {
	w = (screen.width <= 800)  ? (screen.width - 12)   : 1025;
	h = (screen.height <= 600) ? (screen.height - 100) : 680;
	option = 'scrollbars,status,menubar';
	actDate = new Date();
	var cargowin = open('http://ibe.ttline.com/classes/ttline.cargo.CargoServlet?state=login&action=init&lang='+lang,'dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
}


function openDialog(mode, lang) {
	action = '';
	w = (screen.width <= 800)  ? (screen.width - 12)   : 800;
	h = (screen.height <= 600) ? (screen.height - 100) : 600;
	option = 'scrollbars,status,menubar';
	actDate = new Date();
	if (mode == 'booking')
		action = 'RouteParameter';
	else if (mode == 'cancellation')
		action = 'CancelParameters';
	if (lang == 'ENGSWE') {
	  var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.'+action+'?lang=ENGLISH&init='+actDate.getTime()+'&office=INX&agentId=','dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
	}
	else {
	  var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.'+action+'?lang='+lang+'&init='+actDate.getTime()+'&agentId=','dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
	}
}

function openAgent(lang) {
	action = '';
	w = (screen.width <= 800)  ? (screen.width - 12)   : 800;
	h = (screen.height <= 600) ? (screen.height - 100) : 600;
	option = 'scrollbars,status,menubar';
	actDate = new Date();
	action = 'AgentLogin';
	var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.'+action+'?lang='+lang+'&booktype=b2b&init='+actDate.getTime()+'&agentId=','dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
}

function openPackage(code, lang) {
	action = '';
	w = (screen.width <= 800)  ? (screen.width - 12)   : 800;
	h = (screen.height <= 600) ? (screen.height - 100) : 600;
	option = 'scrollbars,status,menubar';
	actDate = new Date();
	action = 'RouteParameter';
	if (lang=='ENGSWE') lang = 'SWEDISH';
	if (lang == 'ENGSWE') {
		var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.'+action+'?lang=ENGLISH&office=INX&init='+actDate.getTime()+'&tarifType='+code+'&agentId=','dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
	}
	else {
		var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.'+action+'?lang='+lang+'&init='+actDate.getTime()+'&tarifType='+code+'&agentId=','dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
	}

}

function openHotelPackage(tarif, hotelId, lang) {
	action = '';
	w = (screen.width <= 800)  ? (screen.width - 12)   : 800;
	h = (screen.height <= 600) ? (screen.height - 100) : 600;
	option = 'scrollbars,status,menubar';
	actDate = new Date();
	action = 'RouteParameter';
	var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.'+action+'?lang='+lang+'&init='+actDate.getTime()+'&tarifType='+tarif+'&hotel='+hotelId+'&agentId=','dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
}

function callChangePwd(lang) {
	option = 'scrollbars,status,menubar';
	var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.ChangePassword?state=init&lang='+lang,'dialog',option+',width='+650+',height='+480+'screenX=0,screenY=0,left=0,top=0');
}

function openTimeTable(lang,frame) {
	option = 'scrollbars,status,menubar';
	timeTable = 'http://ibe.ttline.com/'+lang+'/products.stt/html/calendar.htm';
	if (frame == null) {
		var dialogwin = open(timeTable,'dialog',option+',width='+800+',height='+500+'screenX=0,screenY=0,left=0,top=0');
	}
	else
		top[frame].location = timeTable;
}

function jumpInDialog(lang, route, day, month, year, time) 
{
	w = (screen.width <= 800)  ? (screen.width - 12)   : 800;
	h = (screen.height <= 600) ? (screen.height - 100) : 600;
	option = 'scrollbars,status,menubar';
	actDate = new Date();
	action = 'RouteParameter';
	if (lang == 'ENGSWE') {
		var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.'+action+'?lang=ENGLISH&office=INX&init='+actDate.getTime()+'&descentRoute='+route+'&descentTime='+time+'&descentDay='+day+'&descentMonth='+month+'&descentYear='+year,'dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
	}
	else {
		var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.passage.'+action+'?lang='+lang+'&init='+actDate.getTime()+'&descentRoute='+route+'&descentTime='+time+'&descentDay='+day+'&descentMonth='+month+'&descentYear='+year,'dialog',option+',width='+w+',height='+h+'screenX=0,screenY=0,left=0,top=0');
	}
}

function callBonusCard(lang) {
	option = 'scrollbars,status,menubar';
	var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.bp.BpLogin?lang='+lang,'dialog',option+',width='+800+',height='+480+'screenX=0,screenY=0,left=0,top=0');
}

function callOrderProspect(lang) {
	option = 'scrollbars,status,menubar';
	var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.mpv.DisplayBrochure?lang='+lang+'&state=init','dialog',option+',width='+800+',height='+480+'screenX=0,screenY=0,left=0,top=0');
}

function callOrderAgentProspect(lang) {
	option = 'scrollbars,status,menubar';
	var dialogwin = open('http://ibe.ttline.com/classes/ttline.products.mpv.OrderBrochures?lang='+lang+'&state=init','dialog',option+',width='+800+',height='+480+'screenX=0,screenY=0,left=0,top=0');
}