function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}
function SwapImage(layer,imgName,imgObj) {
	if (document.images) {
		if (document.layers && layer!=null) 
			eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
		else 
			document.images[imgName].src = eval(imgObj+".src")
	}
}
	
preload('logo','/images/logo.gif');
preload('logo_ov','/images/logo_ov.gif');
preload('food','/images/rightCol/tabs/food.png');
preload('food_ov','/images/rightCol/tabs/food_ov.png');
preload('entertainment','/images/rightCol/tabs/entertainment.png');
preload('entertainment_ov','/images/rightCol/tabs/entertainment_ov.png');
preload('sport','/images/rightCol/tabs/sport.png');
preload('sport_ov','/images/rightCol/tabs/sport_ov.png');
preload('advertising','/images/rightCol/bussPromotion.gif');
preload('advertising_ov','/images/rightCol/bussPromotion_ov.gif');
preload('info','/images/info.gif');
preload('info_ov','/images/info_ov.gif');

preload('facebook','/images/rightCol/facebook.gif');
// preload('facebook_ov','/images/rightCol/facebook_ov.gif');

preload('info_en','/images/info_en.gif');
preload('info_en_ov','/images/info_en_ov.gif');
preload('advertising_en','/images/rightCol/bussPromotion_en.gif');
preload('advertising_en_ov','/images/rightCol/bussPromotion_en_ov.gif');

preload('sport_en','/images/rightCol/tabs/sport_en.png');
preload('sport_en_ov','/images/rightCol/tabs/sport_en_ov.png');
preload('food_en','/images/rightCol/tabs/food_en.png');
preload('food_en_ov','/images/rightCol/tabs/food_en_ov.png');
preload('entertainment_en','/images/rightCol/tabs/entertainment_en.png');
preload('entertainment_en_ov','/images/rightCol/tabs/entertainment_en_ov.png');

function resizeMap(to, point)
{
	var height=parseInt($('#map').height());
	if(to){
		var oncomplete=function(){
			zoomToPoint(point);
		};
	}
	else{
		var to=height<mapOpenedHeight?mapOpenedHeight:mapClosedHeight;
		var oncomplete=function(){};
	}

	if(height<to)
		$('#imgMapArrow').attr("src", '/images/header/up.gif');
	else
		$('#imgMapArrow').attr("src", '/images/header/down.gif');

	$('#map').animate({
		height: to
	}, 500, function() {
		oncomplete();
	});
}

var mapSlide;
var mapClosedHeight=175;
var mapOpenedHeight=650;

$(document).ready(function(){ 
    $("ul.sf-menu").supersubs({ 
        minWidth:    17,   // minimum width of sub-menus in em units 
        maxWidth:    27,   // maximum width of sub-menus in em units 
        extraWidth:  0     // extra width can ensure lines don't sometimes turn over 
                           // due to slight rounding differences and font-family 
    }).superfish();  // call supersubs first, then superfish, so that subs are 
                     // not display:none when measuring. Call before initialising 
                     // containing tabs for same reason. 
    tabShow(1);
}); 


function tabShow(id){
	for(var i=1; i<=3; i++){
		if(i==id){
			$('#tab'+i+'on').show();
			$('#tab'+i+'off').hide();
			$('#tab'+i+'content').show();
		}else{
			$('#tab'+i+'on').hide();
			$('#tab'+i+'off').show();
			$('#tab'+i+'content').hide();
		}
	}
}
	
function openwindow(arg,w,h)
	{
	var x=(screen.width-w)/2;
	var y=(screen.height-h)/2;
	window.open(arg,'popup','width='+w+',height='+h+',top='+y+',left='+x+',scrollbars=yes,location=no,toolbar=no');
	}
		

