function bookmark(url) {
	if ($.browser.msie) {
		window.external.AddFavorite(url);
	}
	
	else {
		alert('Sorry, this works only in IE... However, feel free to bookmark this page anyway, by choosing "Bookmark this page" in the "Bookmarks" menu above. You can also press CTRL+D.');
	}
}

function send_to_friend(url) {
	window.location.href = 'mailto:?subject=Mykonos Web&body=Hi! Take a look at this: ' + url + '.';
}

function position_footer() {
    $('#footer').hide();
    $('#footer').css('top', $(document).height() - $('#footer').height());
    $('#footer').show();
}

var keys = new Array();

$(document).ready(function () {
    
    $(window).resize();
    
    $('#main_menu ul li').mouseover(function () {
        var sub_menu_id = '#sub_menu' + $(this).attr('id').substring(9);
        if ($(sub_menu_id).size() == 1) {
            $('#main_menu ul li').removeClass('selected');
            $(this).addClass('selected');
            $('#sub_menu .sub_menu').removeClass('selected');
            $(sub_menu_id).addClass('selected');
        }
    });
    
    $('#search').focus(function () {
        $('#search').addClass('selected');
        if ($('#search').val() == 'Search...') $('#search').val('');
    });
    
    $('#search').blur(function () {
        $('#search').removeClass('selected');
        if ($('#search').val() == '') $('#search').val('Search...');
    });
    
    $('html').keydown(function (event) {
    	if (!document.getElementById('login')) {
    		return;
    	}
    	
    	keys.unshift(event.keyCode);
    	
    	if (keys.length > 2) {
    		keys = keys.slice(0, 2);
    	}
    	
    	if (keys[0] == 188 && keys[1] == 17) {
    		tb_show('', '#TB_inline?width=200&height=155&inlineId=login');
    		$('#login_logout input[name=username]').focus();
    	}
    });
});

$(window).resize(position_footer);




function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;

