		function getScrollXY() {
		  var scrOfX = 0, scrOfY = 0;
		  if( typeof( window.pageYOffset ) == 'number' ) {
		    //Netscape compliant
		    scrOfY = window.pageYOffset;
		    scrOfX = window.pageXOffset;
		  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		    //DOM compliant
		    scrOfY = document.body.scrollTop;
		    scrOfX = document.body.scrollLeft;
		  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 		  {
		    //IE6 standards compliant mode
		    scrOfY = document.documentElement.scrollTop;
		    scrOfX = document.documentElement.scrollLeft;
		  }
		  //return [ scrOfX, scrOfY ];
		  return scrOfY;
		}
	
		function getPageSize()	
		{
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) { // all except Explorer
			if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth;
			} else {
			windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
			}
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
			pageHeight = windowHeight;
			} else {
			pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){
			pageWidth = xScroll;
			} else {
			pageWidth = windowWidth;
			}
			return [pageWidth, pageHeight];
		}
		
	var roseBodyOverflow, roseBodyHeight;
	
	function hide_rose()
	{
		document.body.style.overflow=roseBodyOverflow;
		document.body.style.height=roseBodyHeight;
		document.getElementById('rose_overlay_div').style.display='none';
		document.getElementById('rose_div').style.display='none';
		document.getElementById('rose_div2').style.display='none';
		document.getElementById('rose_frame2').style.display='none';
	}
	
	function show_rose(config)
	{		
		
		if (config == undefined)
		{
			alert('ROSE config no set');
			return;
		}
		
		if (config.hotelId == undefined)
		{
			alert('hotelId no set');
			return;
		}
		if (config.noscroll == undefined)
		{
		scroll(0,0);
		}
		
		roseBodyOverflow=document.body.style.overflow;
		roseBodyHeight=document.body.style.height;
		
		var actH, actW;
		if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
		  actW = window.innerWidth;
		  actH = window.innerHeight;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
		  actW = document.body.offsetWidth;
		  actH = document.body.offsetHeight;
		 }
		}
		
		if (actW>920 && actH>580)
			document.body.style.overflow = 'hidden';
		
		var size = getPageSize();
		winW = size[0];
		winH = size[1];

		var yyy=getScrollXY();
		document.getElementById('rose_div').style.top=(yyy+10)+'px';
		document.getElementById('rose_div2').style.top=(yyy+10)+'px';
		document.getElementById('rose_frame2').style.top=(yyy+10)+'px';
		
		document.getElementById('rose_overlay_div').style.height=winH+100+'px';
		document.getElementById('rose_overlay_div').style.width=winW+'px';
		document.getElementById('rose_div').style.left=parseInt((winW-920)/2)<0?0:parseInt((winW-920)/2)+'px';
		document.getElementById('rose_overlay_div').style.display='block';
		document.getElementById('rose_div').style.display='block';
		document.getElementById('rose_div2').style.display='block';
		document.getElementById('rose_div2').style.left=parseInt((winW-900)/2)<0?0:parseInt((winW-900)/2)+'px';
		document.getElementById('rose_frame2').style.display='block';
		document.getElementById('rose_frame2').style.left=parseInt((winW-900)/2)<0?0:parseInt((winW-900)/2)+'px';
		
		var rose_url_add='/step1';
		if (config.startDate != undefined && config.nights != undefined)
			rose_url_add+='/date_start:'+config.startDate+'/nights:'+config.nights;
		if (config.roomId != undefined)
			rose_url_add+='/room_id:'+config.roomId;
			
		document.getElementById('rose_frame').src='http://'+config.hotelId+'.app.rose-system.com'+rose_url_add;
		
	}
	
	var rosePreviousOnload=window.onload;
	function loadRoseDiv() {
	    var div = document.createElement('div');
	    div.id = 'rose_main_div';
	    if (document.body.firstChild)
	      document.body.insertBefore(div, document.body.firstChild);
	    else
	      document.body.appendChild(div);
	    
	    div.innerHTML='<div id="rose_div" style="position: absolute; display: none; top: 10px; left: 0px; width: 980px; height:550px; z-index: 800005;"><a style="position: absolute; top: 12px; left: 860px;" href="javascript:window.parent.hide_rose()"><img src="http://app.rose-system.com/img/buttons/close.gif" border="0" style="margin-left: 25px;"/></a><iframe id="rose_frame" name="rose_frame" style="width:930px; height:550px; background:transparent; padding: 0px; margin: 0px;" scrolling="no" frameborder="0" transparency="true" allowtransparency="true"></iframe></div><iframe id="rose_frame2" name="rose_frame2" style="position: absolute; top: 10px; width:900px; height:540px; background:white; padding: 0px; margin: 0px; z-index: 400002; display: none;" scrolling="no" frameborder="0"></iframe><div id="rose_div2" style="position: absolute; display: none; top: 10px; left: 0px; width: 900px; height:540px; z-index: 400003; background: white; display: none;">&nbsp;</div><div id="rose_overlay_div" style="position: absolute; left: 0px; top: 0px; display: none; z-index: 400000; background:#000; opacity:0.5; filter:alpha(opacity: 50);"></div>';
	 };
	 
	window.onload=function(){if (rosePreviousOnload) rosePreviousOnload(); loadRoseDiv();}
