

 

var mouseX = 0;
var mouseY = 0;

function delay(prmSec) {
	var eDate = null;
	var eMsec = 0;
	var sDate = new Date();
	var sMsec = sDate.getTime();
	
	do {
	      eDate = new Date();
	      eMsec = eDate.getTime();		
	} while ((eMsec-sMsec)<prmSec);
}

/** 
 * ToolTipp an Mauszeiger positionieren
 */
$(document).ready(function() {
	var arrWindowSize = getSize();
	$(window).scroll(function() {
		arrWindowSize = getSize();
	});	
	$().mousemove(function(e) {
		var intX,intY;
		intX = mouseX = e.pageX+10;		
		intY = mouseY = e.pageY+10;
		
   	}); 
});

/** 
 * Anzeigbaren Bereich des Browsers ermitteln
 */
function getSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [ myWidth, myHeight ];
}

/** 
 * ToolTipp für Bilder
 */
function pageToolTip_picture(booShow,strFilename) {
	$('#divToolTip').css('position','absolute');
	$('#divToolTip').css('left','55%');
	if (booShow) {
		$('#divToolTip').html('<img src="'+strFilename+'" alt="" /><br /><a href="#" onclick="pageToolTip_picture(0,\'\'); return false;">Close</a>');	
		$('#divToolTip').fadeIn('normal');
		$('#divToolTip').css('top',(mouseY-($('#divToolTip').height()/2))+'px'); 
	} else { 
		if ($('#divToolTip').css('display')!='none') {
			$('#divToolTip').css('display','none');
			$('#divToolTip').html('');	
		}
	}
}

/** 
 * Hauptmenü: Städte öffnen/schließen
 */
function pageMenu_openCloseCitys(strId,strCurrentId) {
	if ($('#'+strId).css('display') != 'block') {		
		$('#'+strId).slideDown("normal",function() {
			if (strCurrentId>0) {	
				$('#'+strId+' a').each(function() {
					if ($(this).attr('id') == 'current') {
						$(this).attr('id','');
					}
					if ($(this).attr('rel') == 'city'+strCurrentId) {
						$(this).attr('id','current');
						$(this).css('color','#F0B600');
					}
				});
				$('#'+strId+' li').each(function() {
					if ($(this).attr('id') == 'current') {
						$(this).attr('id','');
						$(this).css('list-style-image', 'url("http://www.osteuropa-hotels.de/s/arrow_normal.gif")'); 
					}
					if ($(this).attr('rel') == 'cityLi'+strCurrentId) {
						$(this).attr('id','current');
						$(this).css('list-style-image', 'url("http://www.osteuropa-hotels.de/s/arrow_active.gif")'); 
					}
				});

			}
		});
	} else {
		$('#'+strId).slideUp('normal');
	}
}

/** 
 * Merkzettel: Details öffnen
 */
function pageNotes_openDetails(strId) {
	if ($.browser.msie) {
		if ($('#'+strId).css('display') != 'block') {		
			$('#'+strId).css('display','block');
		} else {
			$('#'+strId).css('display','none');
		}
	} else {
		if ($('#'+strId).css('display') != 'table-row') {		
			$('#'+strId).css('display','table-row');
		} else {
			$('#'+strId).css('display','none');
		}	
	}
}

/** 
 * Buchungen: Details öffnen
 */
function pageBookings_openDetails(intUserId,intBookingId,strId) {
	var isOpen = false;
	if ($.browser.msie) {
		if ($('#'+strId).css('display') != 'block') {		
			$('#'+strId).css('display','block');
			isOpen = true;
		} else {
			$('#'+strId).css('display','none');
		}
	} else {
		if ($('#'+strId).css('display') != 'table-row') {		
			$('#'+strId).css('display','table-row');
			isOpen = true;
		} else {
			$('#'+strId).css('display','none');
		}	
	}
	if ($('#tableCell'+intBookingId).html() == "") {
		$('#tableCell'+intBookingId).html("Please wait...");
		$.ajax({
		    type: "POST",
		    url: "http://www.osteuropa-hotels.de/pageBookingRequestDetails.htm",
		    data: "intUserId="+intUserId+"&intBookingId="+intBookingId,
			error:function (xhr, ajaxOptions, thrownError){
			    alert(xhr.status+" - "+thrownError);
			},
		    success: function(msg){
				$('#tableCell'+intBookingId).html(msg);
		    }
		});	
	}
}

/** 
 * Buchung: Teilnehmer hinzufügen
 */
var pageBooking_addPerson_intPersonCount = 1;

function pageBooking_addPerson(intPersonCount,strLabel1,strLabel2,strLabel3) {
	if (intPersonCount==1) {
		if (pageBooking_addPerson_intPersonCount>=intPersonCount) {
			alert('Max. '+intPersonCount+' Persons!');
			return false;
		}	
	}
	if (intPersonCount>1) {
		if (pageBooking_addPerson_intPersonCount>intPersonCount) {
			alert('Max. '+intPersonCount+' Persons!');
			return false;
		}		
	}
	intPersonCount+= pageBooking_addPerson_intPersonCount;
	var strHtml = '<tr>';
		strHtml+= '<td style="+char(34)+"padding-right:10px;"+char(34)+"><b>'+intPersonCount+'. '+strLabel1+':</b></td><td>'+strLabel3+': <input type="" name="personSurName[]" value="" size="32" /></td><td>'+strLabel2+': <input type="" name="personFirstName[]" value="" size="32" /></td>';
		strHtml+= '</tr>';
	$('#divPersonsFormTable').append(strHtml);
	pageBooking_addPerson_intPersonCount++;
}


/** 
 * Buchung: Zahlungsmethode 
 */
function pageBooking_selectPaymentMethod(strType) {
	if (strType=='select') {
		$('#divBookingPayment_creditcard').css('display','none');
		$('#divBookingPayment_debit').css('display','none');
		$('#divBookingPayment_select').css('display','block');
	}
	if (strType=='creditcard') {
		$('input[name="bookingPaymentType"]')[0].checked = true;		
		$('#divBookingPayment_select').css('display','none');
		$('#divBookingPayment_creditcard').css('display','block');
	}
	if (strType=='debit') {
		$('input[name="bookingPaymentType"]')[1].checked = true;
		$('#divBookingPayment_select').css('display','none');
		$('#divBookingPayment_debit').css('display','block');
	}
	if (strType=='invoice') {
		$('#divBookingPayment_select').css('display','block');
		$('input[name="bookingPaymentType"]')[2].checked = true;
	}
}

/**
 * Cookies testen
 */
function testCookies() {
	// Cookie setzen
	var datetime = new Date();
	datetime = new Date(datetime.getTime()+1000*60*60*24);
	document.cookie = 'testCookies=true; expires='+datetime.toGMTString()+';'; 
	// Cookie lesen
	var cookie = document.cookie;
	cookiename = cookie.substr(0,cookie.search('='));
	cookiewert = cookie.substr(cookie.search('=')+1,cookie.search(';'));
	if(cookiewert == '') {
		cookiewert = cookie.substr(cookie.search('=')+1,cookie.length);
	} 	
	if (cookiewert) 
		return true;
	else
		return false;
}

/**
 * Delay
 */
function delay(prmSec) {
	prmSec *= 1000;
	var eDate = null;
	var eMsec = 0;
	var sDate = new Date();
	var sMsec = sDate.getTime();
	do {
		eDate = new Date();
		eMsec = eDate.getTime();
	} while ((eMsec-sMsec)<prmSec);
} 

