var popup_x = 100, popup_y = 100;

function showSectionDetail(id_item)
{
	if (!id_item)
		return;

	//openSimpleWindow(site_url + '/popups/section.html?item=' + id_item, 800, 600, 'section');
	window.open(site_url + '/pdfs/' + id_item + '.pdf', 'section', 'scrollbars=yes');
}

function showNewsDetail()
{
	openSimpleWindow(site_url + '/popups/news.html', 408, 679, 'news');
}

function showNewsVideo(id_video)
{
	openSimpleWindow(site_url + '/popups/news-video.html?video=' + id_video, 364, 260, 'video');
}

function showProductDetail(id_product, h)
{
	if (!h)
		h = 679;

	openSimpleWindow(site_url + '/popups/products.html?product=' + id_product, 408, h, 'product');
}

function showGalleryDetail(id_image, h)
{
	if (!h)
		h = 479;

	openSimpleWindow(site_url + '/popups/gallery.html?image=' + id_image, 408, h, 'gallery');
}

function showAwardsDetail(id_image, h)
{
	if (!h)
		h = 479;

	openSimpleWindow(site_url + '/popups/awards.html?image=' + id_image, 408, h, 'awards');
}

function showSectionVideo(id_item)
{
	openSimpleWindow(site_url + '/popups/video.html?item=' + id_item, 364, 260, 'video');
}

function openSimpleWindow(url, width, height, name)
{
	// Mac IE fix - credit: Pascal Weaver of Knitting Pixel. http://www.knittingpixel.com
	if (document.body.clientWidth && window.navigator.appVersion.indexOf('MSIE') != -1 && window.navigator.appVersion.indexOf('Mac') != -1)
	{
		width += 10;
		height += 10;
	}

	if (!name)
		name = '';

	var win = window.open(url, name, 'height=' + height + ',width=' + width + ',left=' + popup_x + ',top=' + popup_y + ',scrollbars=yes,resizable=yes');
	if (win)
		win.focus();
}

function writeQuickTime(el_id, video)
{
	document.getElementById(el_id).innerHTML = '<embed id="popup-video" src="' + video + '" width="360" height="256" autoplay="true" controller="true" loop="false" bgcolor="000000" enablejavascript="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/indext.html"></embed>';
}