var tab_div = new Array('vacations', 'weather_intro', 'weather_full', 'info_intro', 'info_full', 'destinations_intro', 'destinations_full');
var tab_show = new Array();
tab_show[1] = new Array('vacations', 'weather_intro', 'info_intro', 'destinations_intro');
tab_show[2] = new Array('weather_full');
tab_show[3] = new Array('info_full');
tab_show[4] = new Array('destinations_full');

function ctab_click(tab, local_source_path){
	for (i=1; i<5; i++) {
		document.getElementById('ctab_td' + i).style.backgroundImage = document.getElementById('ctab_td' + i).style.backgroundImage.replace("_1.gif", "_0.gif");
	}
	document.getElementById('ctab_td' + tab).style.backgroundImage = document.getElementById('ctab_td' + tab).style.backgroundImage.replace("_0.gif", "_1.gif");
	for (i=0; i<tab_div.length;i++) {
		document.getElementById(tab_div[i]).style.display = 'none';
	}
	for (i=0; i<tab_show[tab].length;i++) {
		if (document.getElementById(tab_show[tab][i]).innerHTML != '') {
			document.getElementById(tab_show[tab][i]).style.display = '';
		}
	}
}

function check_tab_cookie(source_path) {
	if (document.getElementById('info_full') != null && document.getElementById('info_full') != 'undefined') {
		if (document.getElementById('info_full').innerHTML != '') {
			if (get_tab_cookie('show_info_tab') == '1') {
				ctab_click(3, source_path);
				delete_tab_cookie('show_info_tab', '/', '');
			}
		}
	}
}

function set_tab_cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) { expires = expires * 1000; }
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function get_tab_cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) { return null; }
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function delete_tab_cookie( name, path, domain ) {
	if ( get_tab_cookie( name ) ) { document.cookie = name + "=" +
	( ( path ) ? ";path=" + path : "") +
	( ( domain ) ? ";domain=" + domain : "" ) +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT"; }
}

function show_stats_img(id, local_source_path) {
	document.write("<im");
	document.write("g sr");
	document.write("c=\"" + local_source_path + "im");
	document.write("age");
	document.write("s/sta");
	document.write("t.gif?di");
	document.write("d=" + id + "\" border='0' width='1' height='1' />");
}