/**
 * JavaScript Egotec Seite
 */
function show_popup(image, type)
{
	var popTabs, arr, scriptName, image_src;
	var temp = 0;

	popTabs = new Array();

	arr = parseEgotecUrl(image);
	iHeight = arr['height'];
	iWidth 	= arr['width'];
	execCommand = "";

	if(type == 'gtour')
	{
		url = base_url + image;

		Fenster1 = window.open(url, "gTour", "width=" + iWidth + ",height=" + iHeight + ",left=100,top=200,toolbar=no,status=no,menubar=no,location=no");
  		Fenster1.focus();
  		return true;
	}

	// Vorschau Bild

	if(arr['height'] > 440)
	{
		resize = arr['height'] / 440;
		arr['height'] = 440;
		arr['width'] = Math.round(arr['width'] / resize);
	}

	if(arr['width'] > 680)
	{
		resize = arr['width'] / 680;
		arr['width'] = 680;
		arr['height'] = Math.round(arr['height'] / resize);
	}

	image_src = base_url + 'index.php?'
	for(t in arr)
	{
		if(
			t == 'width' ||
			t == 'height' ||
			t == 'id' ||
			t == 'lang' ||
			t == 'site' ||
			t == 'suffix' ||
			t == 'nonactive'
		)
		image_src = image_src + "&" + t + "=" + arr[t];
	}

	popTabs[0] = new Array();
	popTabs[0]['name'] 	= 'image';
	popTabs[0]['title']	= 'Vorschau Bild';
	popTabs[0]['image']	= image_src;


	if(iWidth > 700)
	{
		iWidth	= 700;
	} else
	{
		iWidth = parseInt(iWidth)+60;
	}

	if(iHeight > 500)
	{
		if(egotecSystem.isMSIE)
		{
			iHeight = 510;
		} else
		{
			iHeight = 500;
		}
	} else
	{
		if(egotecSystem.isMSIE)
		{
			iHeight = parseInt(iHeight)+140;
		} else
		{
			iHeight = parseInt(iHeight)+120;
		}
	}

	if(egotecSystem && type != 'gtour')
	{
		egotecSystem.popup('preview', lang == 'de' ? 'Vorschau Bild' : 'Preview Image', iWidth, iHeight, execCommand, popTabs);
	}

}

function hide_popup()
{
	var obj = document.getElementById('popup');
	obj.zIndex = -1000;
	new Effect.Fade(obj);
}


function parseEgotecUrl(url)
{
	var url = url.toString();
	url = url.replace(new RegExp('&amp;', 'gi'), '&');

	url = url.split('?');
	var attribute = url[1].split('&');

	arr = new Array();

	for(var i = 0; i < attribute.length; i++)
	{
		var tmp = attribute[i].split('=');
		arr[tmp[0]] = tmp[1];
	}

	return arr;
}