function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {

	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		resfest_top_nav_17_over = newImage("/i/filmes-over.gif");
		resfest_top_nav_19_over = newImage("/i/musica-over.gif");
		resfest_top_nav_21_over = newImage("/i/palestras-over.gif");
		resfest_top_nav_23_over = newImage("/i/designers_convidados-over.gif");
		resfest_top_nav_25_over = newImage("/i/locais-over.gif");
		resfest_top_nav_27_over = newImage("/i/festas-over.gif");
		
		northamerica_over = newImage("/i/northamerica-over.jpg");
		southamerica_over = newImage("/i/southamerica-over.jpg");
		europe_over = newImage("/i/europe-over.jpg");
		asia_over = newImage("/i/asia-over.jpg");
		africa_over = newImage("/i/africa-over.jpg");
		australia_over = newImage("/i/australia-over.jpg");
		
		preloadFlag = true;
	}
}

///////////////////////ESCOLHE CIDADES///////////////////////////////////////
function World() {
	this.continent = new Array();
	this.city = new Array();
	this.currentCont = '';
		
	this.continent['northamerica'] = [['New York', 'San Francisco', 'Los Angeles'],
									  ['Chicago', 'Toronto', 'Vancouver', 'Montreal']];
	
	this.continent['europe'] = [['London', 'Glasgow', 'Dublin', 'Bristol', 'Belfast', 'Sheffield', 'Nottingham', 'Amsterdam', 'Rotterdam', 'Turin'],
							   ['Rome','Zurich', 'Madrid', 'Barcelona', 'Bilbao', 'Las Palmas', 'Vigo', 'Vienna', 'Istanbul']];
	
	this.continent['asia'] = [['Seoul', 'Tokyo'],
							  ['Kobe', 'Kyoto', 'Singapore']];
		
	this.continent['australia'] = [['Melbourne','Sydney']];
	 
	this.continent['southamerica'] = [['Sao Paulo','Buenos Aires (2006)']];
	
	this.continent['africa'] = [['TBA']];
}

function City( date, location ){
	this.date = date;
	this.location = location;
	
}

/*** define before functions ****/
var thisWorld = new World();

function changeCities(thisContinent){
	//page load, check cookie
	if( thisContinent != 'init' ) { 
	
	thisContinent = thisContinent;
	
	thisWorld.currentCont = thisContinent;
	var citiesArray = thisWorld.continent[ thisContinent ];
	var buildTable = '<table border="0"><tr>';
	for( i=0; i<citiesArray.length;i++){
		var citiesCol = citiesArray[i];
		buildTable += '<td id="citilink" width="72" valign="top">';
		for( j=0; j<citiesCol.length;j++){
			
			var classAdd ="";
			//alterado
			buildTable += '<div class="content-section-link">' + citiesArray[i][j] + '</div>';
		}
		buildTable += '</td>';
	}
	
	buildTable += '</tr></table>';
	
	
	var cityTable = document.getElementById( 'cities' );
	cityTable.innerHTML = buildTable;
	
	continentArray = thisWorld.continent;
	for (var key in continentArray) {
		if( key == thisContinent ){
			document[key].src = '/i/' + key + '-over.jpg';
		}else{
			document[key].src = '/i/' + key + '.jpg';
		}
	}
	
} 
}
