

function showCalendar2(num){

	document.getElementById('calendar').src="./index.php?page=calendar_iframe&dir="+num;


	if(document.all){
		var top = (document.body.clientHeight)/2-60;
		var left = (document.body.clientWidth)/2-105;
	}
	else{
		var top = window.innerHeight/2-60;
		var left =window.innerWidth/2-105;
	}


	document.getElementById('popupcalendar').style.left=left;
	document.getElementById('popupcalendar').style.top=top;
	document.getElementById('popupcalendar').style.display='';

}

function showCalendar(num) {
	var w = 200;
	var h = 230;
	var site="http://www.gratistours.com/index.php?page=calendar_iframe&dir="+num;
	x = screen.availWidth/2-w/2;
	y = screen.availHeight/2-h/2;
	var popupWindow = window.open(
	'http://www.gratistours.com/index.php?page=calendar_iframe&dir=vnd','','width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y);
	//popupWindow.document.write(site);
}

function setSelects(stmp,what){

	for(i=0;i<parent.document.suchmaske.bsd.options.length;i++){
		if(parent.document.suchmaske.bsd.option[i].value=stmp){
			parent.document.suchmaske.bsd.selectedIndex=i;
		}
	}
}




var nc	=	!!(document.captureEvents && !document.documentElement);
var ie	=	!!document.all;
var ie4	=	!!(!document.documentElement && document.all);
var dom	=	!!document.documentElement;
var nc6	=	!!(dom && (!document.all));
var mac	=	!!(navigator.userAgent.indexOf("Mac")!=-1);


var active=0;



function findAktX(num)
{
	return (nc? dRefS(num).x : ((mac && ie)?  dRefS(num).pixelLeft : dRef(num).offsetLeft));
}

function findAktY(num)
{
	return (nc? dRefS(num).y : ((mac && ie)?   dRefS(num).pixelTop : dRef(num).offsetTop));
}



function dRefS(num)
{
	return (nc? document.layers[num] : (ie4? document.all[num].style : document.getElementById(num).style));
}

function dRef(num)
{
	return (nc? document.layers[num] : (ie4? document.all[num] : document.getElementById(num)));
}

function showsubnavi(num){
	if(document.all){
		var top = document.body.clientHeight;
		var left = (document.body.clientWidth-840)/2-4;
		var toptop=120;
	}
	else{
		var top = window.innerHeight;
		var left = (window.innerWidth-840)/2-4;

		var toptop=115;
	}

	xPos=findAktX(num);
	yPos=findAktY(num);
	if(document.getElementById('subnavi'+active)){
		document.getElementById('subnavi'+active).style.display='none';
		document.getElementById('frame'+active).style.display='none';
	}
	if(document.getElementById('subnavi'+num)){
		document.getElementById('subnavi'+num).style.left=xPos+left;
		document.getElementById('subnavi'+num).style.top=yPos+toptop;
		document.getElementById('subnavi'+num).style.display='';

		document.getElementById('frame'+num).style.left=xPos+left;
		document.getElementById('frame'+num).style.top=yPos+toptop;
		document.getElementById('frame'+num).style.display='';
		active=num;
	}
}
var interv;
function hidesubnavi(what){

	interv=setTimeout("hideit('"+what+"')",300);
}
function stophiding(){

	if(interv){clearTimeout(interv);}
}

function hideit(what){

	if(document.getElementById('subnavi'+what)){
		document.getElementById('subnavi'+what).style.display='none';
		if( document.getElementById('frame'+what) )
		document.getElementById('frame'+what).style.display='none';
	}

}

function showsubnavitop(num){
	if(document.all){
		var top = document.body.clientHeight;
		var left = (document.body.clientWidth-840)/2 ;
		var toptop=116;
		win_width = document.body.clientWidth;
	}
	else{
		var top = window.innerHeight;
		var left = (window.innerWidth-840)/2 ;
		win_width = window.innerWidth;
		var toptop=116;
	}
//	alert( left );
	xPos=findAktX(num);
//	alert( left + ' ' + xPos  );
	yPos=findAktY(num);
	new_x = xPos+left;
	var left2 = left + 840;
//	alert( document.getElementById('subnavi'+num).style.width );

	if(document.getElementById('subnavi'+active))
	{
		document.getElementById('subnavi'+active).style.display='none';
//		document.getElementById('frame'+active).style.display='none';
	}
	if(document.getElementById('subnavi'+num))
	{
		document.getElementById('subnavi'+num).style.left=new_x;
		document.getElementById('subnavi'+num).style.top=yPos+toptop;
		document.getElementById('subnavi'+num).style.display='';

//		document.getElementById('frame'+num).style.left = new_x;
//		document.getElementById('frame'+num).style.top=yPos+toptop;
//		document.getElementById('frame'+num).style.display='';
		active=num;
	}
	var width = document.getElementById('subnavi'+num).offsetWidth;
//	var width = 0;
	if( ( width + new_x ) > left2 )
	{
		diff = ( width + new_x ) - left2 ;

//		alert( ( width + new_x ) + ' - ' + win_width + '='+diff);

		new_x = new_x - diff - 14;
		document.getElementById('subnavi'+num).style.left=new_x;
//		document.getElementById('frame'+num).style.left = new_x;
	}
}

// von mainfunction
function createRequestObject()
{
	var ro;
	var browser = navigator.appName;

	if(browser == "Microsoft Internet Explorer") {
		// on IE, we have to use ActiveX
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		// on every other browser, we can directly create a new XMLHttpRequest object
		ro = new XMLHttpRequest();
	}
	return ro;
}

var http = createRequestObject();

// this function should be called for user input
// it opens up a php page with a querystring of 'action'
// this function could probably be adapted to POST
function sndReq(action)
{
	http.open("get", "referer.php?action=" + action);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function handleResponse()
{
	//document.location.reload();
}

function createRequestObject()
{
	var ro;
	var browser = navigator.appName;

	if(browser == "Microsoft Internet Explorer") {
		// on IE, we have to use ActiveX
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		// on every other browser, we can directly create a new XMLHttpRequest object
		ro = new XMLHttpRequest();
	}
	return ro;
}

var http = createRequestObject();

// this function should be called for user input
// it opens up a php page with a querystring of 'action'
// this function could probably be adapted to POST
function sndReq(action)
{
	http.open("get", "ajax.php?action=" + action);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function handleResponse()
{
	document.location.reload();
}

