if (typeof menu_type == 'undefined') menu_type = '';
$(document).ready(function(){
	$.browser.ie6 = ($.browser.msie && $.browser.version == '6.0');
	//fixBottom($('#content .bottom'));

	Banner.start();

	var popup;
	var popup_amindi;
	$('#box-video').click(function(){
		if (popup) popup.close();
		popup = window.open ("http://www.georgia.travel/plbakuriani.html", "mywindow","menubar=1,resizable=1,width=640,height=480");
	});
	$('#box-live').click(function(){
		if (popup) popup.close();
		popup = window.open ("http://www.georgia.travel/plbakuriani.html", "mywindow","menubar=1,resizable=1,width=640,height=480");
	});

	//debugger;

	/*var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}

	else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
*/
	//alert('offsetheight: ' + $('#main')[0].offsetHeight + ' | PageSize: ' + getPageSize()[3]);

	$(window).resize(onResize);
	onResize();


	if (page_name == 'summer') {
		Popunder.image_loc = 'images/summer/div_';
		Popunder.image_count = 3;
	}
	if (page_name == 'food') {
		Popunder.image_loc = 'images/food/eat_div_';
		Popunder.image_count = 6;
	}

	if (page_name == 'winter') {
		Popunder.image_loc = 'images/winter/div_';
		Popunder.image_count = 3;
	}

	$('.thumb').click(function(){
		Popunder.cur_image = $(this).attr('image_num');
		Popunder.showCurrent();
	});
	Popunder.init();
	PopunderAmindi.init();
	//Popunder.showCurrent();
	//Popunder.show('images/div_01.jpg', '');
	MainMenu.init();
	//debugger;


	hint_pos = {//gamoshlid dros chamodis=meti
		banner1: {
			start: {// 95/22
				left: -95,//64
				top: 52 //16
			},
			end: {
				left: -30,//-3, 22, 5
				top: 36
			}
		},
		banner2: {
			start: {
				left: 105,
				top: 68
			},
			end: {
				left: 20,
				top: 45
			}
		},
		banner3: {
			start: {
				left: -125, //110
				top: 58 //28
			},
			end: {
				left: -15,
				top: 30
			}
		},
		banner4: { // 100/40
			start: {
				left: 120,
				top: 65
			},
			end: {
				left: 50,//20, 30, 12
				top: 37//25
			}
		}
	}
	$('.banner-right').each(function(){
		/*var left = (parseInt($(this).css('width'), 10) + 30) + 'px';
		var top =  $(this).css('height');

		$(this).find('.hint-text').css({left: left,top: top});*/

		$(this).find('.hint-wrapper .hint-text').css(hint_pos[this.getAttribute('id')].start);
	});
	$('.banner-right .photo').hover(
		function() {
			//alert(1);
			$(this.parentNode).find('.hint-wrapper .hint-text').stop();
			//hint_pos[this.parentNode.id].end.left = Math.round(hint_pos[this.parentNode.id].end.top * (hint_pos[this.parentNode.id].start.top / hint_pos[this.parentNode.id].start.left));
			$(this.parentNode).find('.hint-wrapper .hint-text').animate(hint_pos[this.parentNode.id].end, 200);
		},
		function() {
			/*var left = (parseInt($(this).find('.hint-wrapper').css('width'), 10) + 30) + 'px';
			var top =  $(this).find('.hint-wrapper').css('height');*/
			$(this.parentNode).find('.hint-wrapper .hint-text').stop();
			$(this.parentNode).find('.hint-wrapper .hint-text').animate(hint_pos[this.parentNode.id].start,200);
		}
	);

	if (page_name == 'summer') {
		var movie_name = 'pano-summer.swf';
	} else {
		var movie_name = 'pano-winter.swf';
	}
	var FO = { movie:movie_name, width:"896px", height:"265px",	majorversion:"9", build:"0", scale: 'noscale', wmode: 'transparent',  swliveconnect:"true"};


	if (UFO.hasFlashVersion(Number(FO.majorversion) + Number(FO.build / 10))) {
		UFO.create(FO, "pano");
	} else {
		$('#noflash').show().css('backgroundImage', 'url(images/bakuriani-statik_0' + (page_name == 'summer' ? 1 : 2) + '.jpg)');

		//'To view the Flash version of the web-site, please download latest version of  <a href="http://www.macromedia.com/go/getflash/" target="_blank">Flash Player.</a>';
	}

	if (page_name == 'home') {
		$('.link-map').click(function(){
			var wid = self.screen.width - 24;
			if (wid > 2000) wid = 2000;
			var hei = wid * (1400 / 2000);
			//var hei = self.screen.height - 100;
			var x = (self.screen.width - wid) / 2;
			var y = (self.screen.height - hei) / 2;
			window.open('map.html','', 'top='+y+', left='+x+', screenX='+x+', screenY='+y+', width='+wid+', height='+hei+', menubar=no, status=no, scrollbars=no, resizable=no, toolbar=no');
			return false;

		});
	}

	if (page_name == 'home' || page_name == 'trips') {
		$('#showmore').click(function(){
			/*$('#heitest').css({
				position: 'absolute',
				height: '1500px',
				width: '100px',
				backgroundColor: 'red'
			});*/
			//alert($('#content .bg2')[0].offsetHeight);
			$('#morecontent').show();
			fixHeight();
			onResize();
			//$('#content .bg2').css('height', $('#content .bg2')[0].offsetHeight);

			$(this).hide();

		});

	}

	if (page_name == 'rentals') {
		if ($.browser.msie) {
			$('#snowboard').animate({bottom: "+=100px"}, 500);
		} else {
			$('#snowboard').animate({top: "-=100px"}, 500);
		}
	}
	if (page_name == 'hotels') {
		//$('#chustebi').animate({top: "-=100"}, 500);
		if ($.browser.msie) {

			$('#chustebi').animate({bottom: "+=100px"}, 500);
		} else {
			$('#chustebi').animate({top: "-=100px"}, 500);
		}
		$('.hotel-photo').click(function(){
			//Popunder_hotels.showCurrent();
			var hot_images = [];
			var cur_hotel = parseInt($(this).attr('hotel-id'), 10);
			for (var i = 1; i < hotel_images[cur_hotel][1]; i++) {
				hot_images.push('images/hotels/shida/' + hotel_images[cur_hotel][0] + '/' + ((('' + i).length == 1) ? '0': '') + i + '.jpg');
			}
			Popunder.images = hot_images;
			Popunder.isHotels = true;
			Popunder.cur_hotel = cur_hotel;
			Popunder.cur_image = 0;
			Popunder.showCurrent();
			return false;
		});
		$('.hotels-link').click(function(){
			$(this).find('.hotel-photo').click();
			return false;
		});
	}
	if (page_name == 'food') {
		//$('#lavashi').animate({left: 220, top: 490}, 1000);
		//$('#mcvadi').animate({left: 530, top: 520}, 1000);
	}

	if ($.browser.mozilla) {
		flash_intId = setInterval(iframeSwitch, 100);
	} else {
		$('#pano').show();
	}

	$('#banner1').click(function(){
		Popunder.showCurrent();
	});
	$('#box-amindi .more').click( function(){
		PopunderAmindi.show();
	});

	$('.event-more').click(function(){
		var event_text = $('#event-text-' + $(this).attr('event-id'));
		var event_desc = $('#event-desc-' + $(this).attr('event-id'));
		var event_photoebi = $('#event-photoebi-' + $(this).attr('event-id'));

		$(this).hide();
		$('.event-more').not(this).show();

		$('.event-text').not(event_text).hide();
		event_text.show();

		$('.event-photoebi').not(event_photoebi).hide();
		event_photoebi.show();

		$('.event-desc').not(event_text).show();
		event_desc.hide();
		fixHeight();
		onResize();

		return false;
	});
});




var height_plus = 0;
function onResize(){
	if ($('#main')[0].offsetHeight < getPageSize()[3]) {
		height_plus += (getPageSize()[3] - $('#main')[0].offsetHeight);
		$('#main').height(getPageSize()[3]);
		//alert(height_plus);
	} else {
		var height_old = $('#main').height();
		var height_new = Math.max(getPageSize()[3], height_old - height_plus);
		$('#main').height(height_new);

		//alert('height_old' + height_old +'; height_new' + height_new + ' ; getPageSize()[3]' + getPageSize()[3]);
		height_plus -= (height_old - height_new);
	}

	$('#xalicha').css('height', $('#main')[0].offsetHeight);
	/*if ($('#main').height() > $(document.body).height()) {
		$(document.body).height($('#main').height());
	}*/

	//debugger;
	//$('#xalicha').css('height', $('#main')[0].offsetHeight);
	//return;
	//alert('main: ' + $('#main')[0].offsetHeight + ' | page:' + getPageSize()[3]);
	//alert(1);

	///new
	/*
	var screen_height = getPageSize()[3];
	var main_height = $('#main')[0].offsetHeight;
	//alert(screen_height + ' - ' + main_height);
	if (main_real_height == -1) {
		main_real_height = main_height;
	}
	var target_height = Math.max(main_real_height, screen_height);
	$('#main').height(target_height);
	*/


	///old
/*	if (main_real_height > getPageSize()[3]) {
		$('#main').height(main_real_height);
	} else {
		if ($('#main')[0].offsetHeight < getPageSize()[3]) {
			$('#main').height(getPageSize()[3]);
		}
	}*/


	//alert(7);
//	alert($(document.body).height());
	//alert($('#main')[0].offsetHeight);




/*		if ($('#main')[0].offsetHeight < 850) {
		//$('#main').css('height', '850px');
	}
*/
}
function fixHeight() {

	//if ($.browser.msie) {

		if (page_name != 'food' ) {
			if (page_name == 'summer' ) {
				$('#main').height($('#content').height() + 390);
			} else {
				$('#main').height($('#content').height() + 360);
			}
		}

	///}

	//alert('main height: ' + $('#main').height() + ' | footer-bottom top: ' + $('#footer-bottom')[0].offsetTop);
	/*if (page_name == 'summer') {
		$('#footer').css('bottom', '3px');
		$('#footer-bottom').css('bottom', '-297px');
	}*/

	var heiDif = $('#content .bg2').height() - $('#content').height();
	$('#content').css('height', $('#content .bg2').height());
	$('#middle').css('height', $('#middle').height() + heiDif + 'px');
	$('#main').css('height', $('#main').height() + heiDif + 'px');
	return;
	alert($('#content .bg2')[0].offsetHeight + ' | ' + $('#content')[0].offsetHeight);
	$('#content').css('height', $('#content .bg2').height());
	$('#middle').css('height', $('#middle').height() + heiDif + 'px');
	$('#main').css('height', $('#main').height() + heiDif + 'px');
	$(document).css('height', $('body').height() + heiDif + 'px');
	alert($('body')[0].offsetHeight + ' | ' + $('body')[0].offsetHeight);
	onResize();
}
function fixBottom(elem) {
		$(elem).css({
			top: $(elem).parent().height() + 'px'
		});

	/*if ($(elem).css('bottom') == '0px') {
		$(elem).css({
			bottom: '',
			top: ($(elem).parent().height() - $(elem).height()) + 'px'
		});
	}*/
}

Banner = {
	showImage: function (banner, image_num) {
		//debugger;
		$(banner[0]).attr('item_active', image_num);
		var image = $(banner).find('.item' + image_num);
		var image_old = $(banner).find('.item_active');
		image_old.removeClass('item_active');
		image.addClass('item_active');

		/*alert(image_old.length);
		image_old.css('zIndex', '1');
		image_old.animate({'opacity': 0}, 1000);
		image.css('zIndex', '4');*/
		image_old.css('zIndex', '1').animate({'opacity': 0}, 1000);
		image.css('zIndex', '4').animate({'opacity': 1}, 1000);
	},
	start: function() {
		//return;
		/*$('.banner-right .image').animate({
			'opacity': 0
		}, 1);*/
		/*var images = $('#banner1');
		console.dir(images);
		return;*/
		$('.banner-right .image').not('.item_active').css({
			'opacity': 0,
			'filter': 'alpha(opacity=0)'
		});

		$('.banner-right').each(function(){
			this.item_active = 4;
		});
		var cur = 0;

		//if (!$.browser.ie6) {

			int1 = setInterval(function(){
				intId = setInterval(function(){
					//console.log(1);
					//var rand = Math.round(Math.random() * 3) + 1 ;
					cur = cur % 4 + 1;
					var rand = cur;
					Banner.showImage($('#banner' + rand), ($('#banner' + rand)[0].getAttribute('item_active')) % 4 + 1);
				}, 2000);
				clearInterval(int1);
			}, 2000);

				/*int1 = setInterval(function() {
			 intId = setInterval(function(){
			 //console.log(1);
			 Banner.showImage($('#banner1'), ($('#banner1')[0].getAttribute('item_active')) % 4 + 1);
			 }, 3000);
			 clearInterval(int1);
			 }, 2000);



			 int2 = setInterval(function(){
			 var intWait = setInterval(function(){
			 Banner.showImage($('#banner2'), ($('#banner2')[0].getAttribute('item_active')) % 4 + 1);
			 }, 2000);
			 clearInterval(int2);
			 }, 	3000);

			 int3 = setInterval(function(){
			 var intWait = setInterval(function(){
			 Banner.showImage($('#banner3'), ($('#banner3')[0].getAttribute('item_active')) % 4 + 1);
			 }, 2000);
			 clearInterval(int3);
			 },
			 4000);

			 int4 = setInterval(function(){
			 var intWait = setInterval(function(){
			 Banner.showImage($('#banner4'), ($('#banner4')[0].getAttribute('item_active')) % 4 + 1);
			 }, 2000);
			 clearInterval(int4);
			 },
			 5000);*/
		//}

	}
}



MainMenu = {
	image_folder : 'images/menu/txt/',
	getNormalSrc: function(item) {
		return MainMenu.image_folder + item + '_b.png';
	},
	getActiveSrc: function (item) {
		return MainMenu.image_folder + item + '_a.png';
	},
	getHoverSrc: function(item) {
		return MainMenu.image_folder + item + '_a.png';
	},
	itemNormal: function() {
		$(this).children('.item-text').css('backgroundImage', 'url(' + MainMenu.getNormalSrc(this.getAttribute('item_name')) + ')');
	},
	itemActive: function() {
		//$(this).css('zIndex', '5');
		$(this).children('.item-shad').hide();
		$(this).children('.item-text').css('backgroundImage', 'url(' + MainMenu.getActiveSrc(this.getAttribute('item_name')) + ')');
	},
	itemOver: function() {
		if ($(this).is('.item_active')) return;
		if ($(this).is('.item_hover')) return;
		$(this).addClass('item_hover');
//			alert($(this).css('backgroundImage'));
		$(this).children('.item-text').css('backgroundImage', 'url(' + MainMenu.getHoverSrc(this.getAttribute('item_name')) + ')');
	},
	itemOut: function() {
		if ($(this).is('.item_active')) return;
		if ( ! $(this).is('.item_hover')) return;
		$(this).removeClass('item_hover');
		MainMenu.itemNormal.call(this);
	},
	init: function(){
		var preload = [];
		var preload_images = [];
		$('#menu div.item-wrapper').hover(
			function(){
				MainMenu.itemOver.call(this);
			},
			function(){
				MainMenu.itemOut.call(this);
			}
		).each(function(){
				if ($(this).is('.item_active')) {
					MainMenu.itemActive.call(this);
				} else {
					MainMenu.itemNormal.call(this);
					image_preload(MainMenu.getHoverSrc(this.getAttribute('item_name')));
					//preload.push(MainMenu.getNormalSrc(this.getAttribute('item_name')));
					//preload.push(MainMenu.getHoverSrc(this.getAttribute('item_name')));
				}
			}
		);
		/*for(var i in preload) {
			var img = new Image();
			img.src = preload[i];
			preload_images.push(img);
		}*/
	}
}
var hotel_images = [
	['almarini-gusethouse', 5],
	['alpina', 6],
	['guesthouse-edelvaisi', 11],
	['guest-house-kristali', 7],
	['guest_house_leonidi2.jpg', 0],
	['guest-house-melisi', 7],
	['guest-house-sandro-papa', 6],
	['Guest-House-tamar-mefe', 7],
	['guest_house_tetri_saxli2.jpg', 0],
	['guest-house-tovlis-babua', 5],
	['guest-house-vardisferi-sastumro', 7],
	['Guset-house-vila-Bakuriani', 5],
	['gust_house_olimpo2.jpg', 0],
	['hotel-apoloni', 6],
	['hotel-evrika', 0],
	['hotel-kristali', 8],
	['hotel-Tbilisi', 10],
	['hotel-vere-palace', 9],
	['Hotel-Viktoria', 12],
	['hotel-Vila-Palaci', 8],
	['hotel-villa-park', 7],
	['premier-palace', 4],
	['sportslola-ikiski', 4]
]

Popunder = {
	cur_image : 1,
	image_count: 34,
	image_loc : 'images/div/',
	hotel_loc: 'images/hotels/',
	hotels: [
			 ['almarini_gusethouse2.jpg', '', '', '', ''],
			 ['alpina2.jpg',  '', '', '', ''],
			 ['guest_house_edelvaisi2.jpg',  '', '', '', ''],
			 ['guest_house_kristali2.jpg',  '', '', '', ''],
			 ['guest_house_leonidi2.jpg',  '', '', '', ''],
			 ['guest_house_melisi2.jpg',  '', '', '', ''],
			 ['guest_house_sandro_papa2.jpg',  '', '', '', ''],
			 ['Guest_House_tamar_mefe2.jpg',  '', '', '', ''],
			 ['guest_house_tetri_saxli2.jpg',  '', '', '', ''],
			 ['guest_house_tovlis_babua2.jpg',  '', '', '', ''],
			 ['guest_house_vardisferi_sastumro2.jpg',  '', '', '', ''],
			 ['Guset_house_vila_Bakuriani2.jpg',  'Vila bakuriani', '', '899 58 81 62', 'Queen Tamar st. # 4'],
			 ['gust_house_olimpo2.jpg', '', '', '', ''],
			 ['hotel_apoloni2.jpg', '', '', '', ''],
			 ['hotel_evrika2.jpg', '', '', '', ''],
			 ['hotel_kristali2.jpg', 'Kristali', '48', '899 50 51 03, 899 10 60 21', 'Tsabadze # 3'],
			 ['hotel_Tbilisi2.jpg',  'Hotel Tbilisi', '100', '899 58-48-50', 'Gorki # 2'],
			 ['hotel_vere_palace2.jpg', 'Vere palasi', '', '899 11-60-45', 'Tsaqadze # 12'],
			 ['Hotel_Viktoria2.jpg', 'Viktoria', '', '895 55-21-52', 'Agmashenebeli # 92'],
			 ['hotel_Vila_Palaci2.jpg', 'Vila palasi', '', '826 74 02 73', 'Tsaqadze # 1'],
			 ['hotel_villa_park2.jpg', 'Vila Parki', '165', '(8 267)  4-04-05', 'Rustaveli'],
			 ['premier_palace2.jpg', 'Premier palasi', '45', '899 51 09 73', 'Koba Tsakadze'],
			 ['sportslola_ikiski2.jpg', '', '', '', '']
	],
	isHotels : false,
	init: function() {
		var that = this;
		//this.cur_image = 1;
		if (this.image_count == 1) {
			$('#popunder .but-close').hide();
			$('#popunder .but-left').hide();
		} else {
			$('#popunder .but-close').show();
			$('#popunder .but-left').show();

			$('#popunder .but-left').click(function(){
				that.showPrev();
			});
			$('#popunder .but-right').click(function(){
				that.showNext();
			});
		}
		$('#popunder .but-close, #popunder-bg').click(function(){
			if (that.isHotels) that.isHotels = true;
			that.close();
			PopunderAmindi.close();
		});
	},
	close: function() {
		$('#popunder').hide();
		$('#popunder-bg').hide();
	},
	show: function(image, description){
		//alert(description);
		//alert('url(' + image + ')');
		//image = 'images/hotels/shida/premier palace/01.jpg';
		$('#popunder-bg').width($(document.body).width()).height($(document.body).height());
		$('#popunder-bg').show();
		$('#popunder .photo').css('backgroundImage', 'url(' + image + ')');
		//alert('url(' + image + ')');
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var myHeight = parseInt($('#popunder .right').css('height'), 10);
		var top = arrayPageScroll[1] + (arrayPageSize[3] - myHeight) / 2 - 40;
		//var left = (arrayPageSize[0] - $('#popunder').width()) / 2;
		//alert(description);
		$("#popunder .description").html(description);
		$("#popunder").css({display:"block", top:top, left:150});
	},
	showCurrent: function() {
		if (this.isHotels) {
			var desc = '<p class="pu_heading">'+this.hotels[this.cur_hotel][1]+'</p>';
			if (this.hotels[this.cur_hotel][2] != '') desc += '<p>Price with food: '+this.hotels[this.cur_hotel][2]+'</p>';
			if (this.hotels[this.cur_hotel][3] != '') desc += '<p>PHONE: '+this.hotels[this.cur_hotel][3]+'</p>';
			if (this.hotels[this.cur_hotel][4] != '') desc += '<p>ADDRESS: '+this.hotels[this.cur_hotel][4]+'</p>';
			this.show(this.images[this.cur_image],  desc);
		} else {
			this.show(this.image_loc + this.cur_image + '.jpg');
		}
	},
	showPrev: function() {
		Popunder.cur_image --;
		if (this.isHotels)
			if (this.cur_image == 0) this.cur_image = this.images.length;
			else if (this.cur_image == 0) this.cur_image = this.image_count;
		this.showCurrent();
	},
	showNext: function() {
		this.cur_image ++;
		if (this.isHotels)
			if (this.cur_image == this.images.length) this.cur_image = 0;
			else if (this.cur_image == this.image_count + 1) this.cur_image = 1;
		this.showCurrent();
	}
}


PopunderAmindi = {
	init: function() {
		$('#popunder-amindi .close, #popunder-bg').click(function(){
			PopunderAmindi.close();
			Popunder.close();
		});
	},
	close: function() {
		$('#popunder-amindi').hide();
		$('#popunder-bg').hide();
	},
	show: function(image, description){
		$('#popunder-bg').width($(document.body).width()).height($(document.body).height());
		$('#popunder-bg').show();

	    var arrayPageSize = getPageSize();
	    var arrayPageScroll = getPageScroll();
		var myHeight = parseInt($('#popunder-amindi .right-edge').css('height'), 10);
	    var top = arrayPageScroll[1] + (arrayPageSize[3] - myHeight) / 2 - 40;
	    //var left = (arrayPageSize[0] - $('#popunder').width()) / 2;

	    $("#popunder-amindi").css({display:"block", top:top, left:150});
	}
}



function getPageScroll() {
    var yScroll;
    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
        yScroll = document.documentElement.scrollTop;
    } else if (document.body) {
        yScroll = document.body.scrollTop;
    }
    arrayPageScroll = new Array("", yScroll);
    return arrayPageScroll;
}

function getPageSize() {
    var xScroll, yScroll;
    if (window.innerHeight && window.scrollMaxY) {
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) {
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else {
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    var windowWidth, windowHeight;
    if (self.innerHeight) {
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) {
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }
    if (yScroll < windowHeight) {
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }
    if (xScroll < windowWidth) {
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }
    arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
    return arrayPageSize;
}

function iframeSwitch()
{
	//return;
	//find flash content container and grab contents
	//(should only be object and embed tags)
	var container = $("#pano");
	container.show();
	//console.dir(container);
	var c = container.html();
	if (c == '') return;
	clearInterval(flash_intId);
	c = '<style> body{margin:0}</style>'+c;

	//get the size from the object element
	var object = $("embed",container);
	var x = object.width();
	var y = object.height();

	//create the iframe element, hidden for now
	var frame = $.IFRAME({
		id:'graph_content_frame',
		frameborder:'0',
		marginwidth:'0',
		marginheight:'0',
		scrolling:'no'
	});
	$(frame).css('display','none');

	//attach the iframe to the document and remove the
	//old flash container element
	container.after(frame).remove();

	//set the size, open the iframe, and insert
	//the flash content.
	$("#graph_content_frame")
	.css('border','none')
	.height(y+'px')
	.width(x+'px')
	.css('display','block')
	.each(function(){
		this.contentDocument.open();
		this.contentDocument.write(c);
		this.contentDocument.close();
	});
}

preload_array = [];
function image_preload(src) {
	var img = new Image();
	img.src = src;
	preload_array.push(img);
}

function logo_hide() {
	$('#logo').animate({'opacity': 0});
}
function logo_show() {
	$('#logo').animate({'opacity': 1});
}

function object(o) {
	function F() {}
	F.prototype = o;
	return new F();
}
