var sUserAgent = navigator.userAgent;
var isOpera = sUserAgent.indexOf("Opera") > -1;
var isIE = sUserAgent.indexOf("compatible") > -1 && sUserAgent.indexOf("MSIE") > -1 && !isOpera;
var OverLeftMenu = 0;

function display_get_absolute_offset_top(obj, otop) {
	var y = obj.offsetTop;
	while (obj = obj.offsetParent)
		y += obj.offsetTop;
    y += otop;
	if(isIE)
	{
		return y;
	}
	else
	{
		return y+"px";
	}
}

function display_get_absolute_offset_left(obj, oleft) {
	var x = obj.offsetLeft;
	while (obj = obj.offsetParent)
		x += obj.offsetLeft;
    x += oleft;
	if(isIE)
	{
		return x;
	}else
	{
		return x+"px";
	}
}

function display_bookmark_link(title, url) {
    title = (title == '') ? "UOMacau.com" : title;
    url = (url == '') ? "http://www.uomacau.com" : url;
    url = 'http://www.uomacau.com' + url;
    if (window.sidebar) {
    // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title, url, "");
    }else if( window.external ) {
    // IE Favorite
        window.external.AddFavorite( url, title);
    }else if(window.opera && window.print) {
        return true;
    }
}

function display(id, value) {
	$(id).style.display = value;
}

function display_page(nowpage, total, prefix) {
	var prefix = prefix ? prefix : 'page';
	for(i=1;i<=total;i++) {
		$(prefix+i).style.display='none';
	}
	$(prefix+nowpage).style.display='';
}

function display_pagebtn(nowpage, total, prefix) {
	var prefix = prefix ? prefix : 'page';
	for(i=1;i<=total;i++) {
		$(prefix+i).style.display='none';
		$(prefix+'rbtn'+i).className='';
	}
	$(prefix+nowpage).style.display='';
	$(prefix+'lbtn'+nowpage).className='lbtnclick';
	$(prefix+'rbtn'+nowpage).className='rbtnclick';
}

function display_shopbtn(nowpage, total, prefix) {
	var prefix = prefix ? prefix : 'page';
	for(i=1;i<=total;i++) {
		$(prefix+i).style.display='none';
		$(prefix+'lbtn'+i).className='step_1_b';
		$(prefix+'rbtn'+i).className='step_font_b';
	}
	$(prefix+nowpage).style.display='';
	$(prefix+'lbtn'+nowpage).className='step_1_a';
	$(prefix+'rbtn'+nowpage).className='step_font_a';
}

function display_blackbtn(nowpage, total, prefix) {
	var prefix = prefix ? prefix : 'page';
	for(i=1;i<=total;i++) {
		$(prefix+i).style.display='none';
		$(prefix+'lbtn'+i).className='step_2_b';
		$(prefix+'rbtn'+i).className='step_font_b';
	}
	$(prefix+nowpage).style.display='';
	$(prefix+'lbtn'+nowpage).className='step_2_a';
	$(prefix+'rbtn'+nowpage).className='step_font_a';
}


function display_toptab(nowpage, total, prefix) {
	var prefix = prefix ? prefix : 'page';
	for(i=1;i<=total;i++) {
		$(prefix+i+'head').style.display='none';
        $(prefix+i+'body').className='toptab_1_b';
        $(prefix+i+'linka').className='step_font_b';
        $(prefix+i+'end').style.display='none';
	}
	$(prefix+nowpage+'head').style.display='';
    $(prefix+nowpage+'body').className='toptab_1_a';
   $(prefix+nowpage+'linka').className='white bold';
    $(prefix+nowpage+'end').style.display='';
}

function display_act(accordion, toggler, element){
    window.addEvent('domready', function() {
    //create our Accordion instance
	var myAccordion = new Accordion($(accordion), toggler, element, {
      opacity: false,
      onActive: function(toggler, element){
        toggler.setStyle('color', '#41464D');
      },
      onBackground: function(toggler, element){
		toggler.setStyle('color', '#528CE0');
      }
	});
  });
}

function display_set_empty(elem, value){
    if( elem.value == value ){
        elem.value = '';
    }
}

function display_set_value(elem, value, color){
    if( elem.value == "" ){
        elem.value = value;
        elem.style.color = '#' + color;
    }
}

function display_set_class(elem, className){
    elem.className = className;
}

function display_set_fontcolor(elem, value){
    elem.style.color = '#' + value;
}

function display_set_change(elem, value, orgcolor, newcolor){
    if( elem.value == value ){
        elem.style.color = '#' + orgcolor;
    }
    else elem.style.color = '#' + newcolor;
}

function display_select_hotel_star(star_id, star_num, star_count)
{
    for(i=1;i<=star_num;i++)
    {
      document.getElementById(star_id+i).src="/images/www/default/star_1/1.gif";
    }
    for(i=(star_num+1);i<=star_count;i++)
    {
      document.getElementById(star_id+i).src="/images/www/default/star_1/3.gif";
    }
}