var windowWidth,windowHeight, scrOfX, scrOfY;

// popUp(x,y,w,h,cid,text,bgcolor,textcolor,fontstyleset,title,titlecolor,titletextcolor,bordercolor,scrollcolor,shadowcolor,showonstart,isdrag,isresize,oldOK,isExt)
var counter=0;
function open_window(x, y, w, h, cid, text, title, isExt, isresize, bgcolor, bordercolor) {
	counter++;
	if (self.innerHeight) { // all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight; 
	    scrOfY = window.pageYOffset;
    	scrOfX = window.pageXOffset; }
	else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight; 
		scrOfY = document.documentElement.scrollTop;
   		scrOfX = document.documentElement.scrollLeft; }
	else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight; 
		scrOfY = document.body.scrollTop;
	    scrOfX = document.body.scrollLeft; }
	
	new popUp(((windowWidth+scrOfX-x)/2), ((windowHeight+scrOfY-y)/2), w, h, (cid+counter), text, bgcolor, "black" , "10pt verdana", title, "white", "#000000", bordercolor, "#6DBAF3", "black", true, true, isresize, false, isExt); }

function news_page(page) { open_window(640 , 480 , '640' , '480' , 'news' , page , 'Latest News', true, true, 'white', 'white') }
function icpopup(page, title, win_width, win_height) { open_window(win_width , win_height, win_width , win_height, 'ic' , page , title, true, true, 'white', 'white') }
function resortpage(page, title) { open_window(620 , 560 , '620' , '560' , 'resorts' , page , title, true, true, 'white', 'white') }
function info_page(page, title) { open_window(640 , 480 , '640' , '480' , 'info' , page , title, true, false, 'white', 'white') }
function forum_page() { open_window(800 , 800 , '800' , '800' , 'forums' , 'forum/' , 'Crown Tours Maldives - Community Forums', true, true, 'white', 'white') }
function weather_page() { open_window(600 , 400 , '600' , '400' , 'weather' , 'http://www.key-res.com/reserve.php?hid=MLE11431&sh=no' , 'Local Weather', true, true, 'white', 'white') }
function booking_page(page) { open_window(800 , 600 , '800' , '600' , 'booking' , page , 'Booking Engine', true, true, 'white', 'white') }


function roomrate(page, title) { open_window(640 , 480 , '640' , '480' , 'roomrate' , page , title, true, false, 'white', 'white') }
function largepicture(page) { open_window(460 , 400 , '460' , '400' , 'largepict' , page , 'Large Picture', true, false, 'white', 'white') }


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 ];
}