﻿	function showmap(id, isinternational) {
	var href='showroot.asp?id='+id+'&int='+isinternational;
	var op=window.open(href, "routemap", "width=500px,height=400px,scrollbars=yes,menubar=no,toolbar=no,resizable=yes");
	op.focus();
	}
	
function checksch(id) {
	var frm=document.forms[0];
	var pas;
	var veh;
	pas=frm.reqPassengers.options[frm.reqPassengers.selectedIndex].value;
	veh=frm.reqVehicles.options[frm.reqVehicles.selectedIndex].value;
	var h='checksch.asp?id='+escape(id)+'&dt='+FormatRouteDate;
	if (document.Form1.reqRoundTrip[0].checked) {h+='&rdt='+FormatRetRouteDate;}
	h+='&tp='+pas;
	h+='&tv='+veh;
	var op=window.open(h, 'check_schedule', 'width=800,height=550,scrollbars=yes,location=no,resizable=yes');
	op.focus();
}

	
function offline_reserv(id) {
	var frm=document.forms[0];
	var pas;
	var veh;
	
	//offline_reserv.asp?schid=9346&dt=27%2F7%2F2007&rschid=9342&rdt=28%2F7%2F2007&tp=2&tv=1
	
	pas=frm.reqPassengers.options[frm.reqPassengers.selectedIndex].value;
	veh=frm.reqVehicles.options[frm.reqVehicles.selectedIndex].value;
	
	if (document.Form1.reqRoundTrip[0].checked) {
		var h='offline_returnLeg.asp?schid='+escape(id)+'&dt='+FormatRouteDate+'&rdt='+FormatRetRouteDate+'&tp='+pas+'&tv='+veh;
		var op=window.open(h, 'offline_returnLeg', 'width=800,height=550,scrollbars=yes,location=yes,resizable=yes');
		op.focus();}
	else {
		var h='offline_reserv.asp?schid='+escape(id)+'&dt='+FormatRouteDate+'&tp='+pas+'&tv='+veh;
		location.href=h;}
}

function showvessel(as) {
	var op=window.open ('univerphotoalbum.asp?tp=ship&as='+as,"CompanyPhotoAlbum","scrollbars=yes,width=550,height=500,resizable=yes");
	op.focus();
}

function show_errmes(obj, errmessage) {

	document.getElementById("err_container").innerHTML=errmessage;
	shared.showObj1UnderObj2("err_container", obj);
} 

function hide_errmes() {
document.getElementById("err_container").style.display="none";
}

//info pop-ups
function close_popup(id) {
	var el=document.getElementById(id);
	el.style.display="none";
}

function showInfo_popup(id) {
	var Pos=findHelpPos();
	//alert(Pos.x+';'+Pos.y);
	blockAll();
	var el=document.getElementById(id);
	el.style.left=Pos.x+"px";
	el.style.top=Pos.y+"px";
	el.style.display="block";
}

function findHelpPos() {
    var scrollX = 0, scrollY = 0;
    if (document.body && typeof document.body.scrollTop != "undefined") {
        scrollX += document.body.scrollLeft;
        scrollY += document.body.scrollTop;
        if (document.body.parentNode && 
            typeof document.body.parentNode.scrollTop != "undefined") {
            scrollX += document.body.parentNode.scrollLeft;
            scrollY += document.body.parentNode.scrollTop;
        }
    } else if (typeof window.pageXOffset != "undefined") {
        scrollX += window.pageXOffset;
        scrollY += window.pageYOffset;
    }
	var Pos=new Object();
    Pos.x = Math.round(getInsideWindowWidth() + scrollX - 250);
    Pos.y = Math.round((getInsideWindowHeight( )/2) + scrollY - 150);
	return Pos;
}

function getInsideWindowHeight( ) {
    if (window.innerHeight) {
        return window.innerHeight;
    } else if (document.body.parentElement.clientHeight) {
        return document.body.parentElement.clientHeight;
    } else if (document.body && document.body.clientHeight) {
        return document.body.clientHeight;
    }
    return 0;
}

function getInsideWindowWidth( ) {
    if (window.innerWidth) {
        return window.innerWidth;
    } else if (document.body.parentElement.clientWidth) {
		return document.body.parentElement.clientWidth;
    } else if (document.body && document.body.clientWidth) {
        return document.body.clientWidth;
    }
	
    return 0;
}

function blockAll(){
	close_popup('booking');
	close_popup('locSearch');
	close_popup('locRefine');
	close_popup('effectivePeriod');
	close_popup('broadenPeriod');
	close_popup('rank');
	close_popup('vesselTypes');
	close_popup('bookInfo');
}




