﻿// Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

hs.graphicsDir = 'highslide/graphics/';
hs.outlineType = 'rounded-white';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'rounded-white';
hs.fadeInOut = true;
//hs.dimmingOpacity = 0.75;

// Add the controlbar
hs.addSlideshow
(
	{
		//slideshowGroup: 'group1',
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: 'fit',
		overlayOptions: 
		{
			opacity: .75,
			position: 'bottom center',
			hideOnMouseOut: true
		}
	}
);

function menuOver(obj)
{
	obj.oldClass = obj.className;
	if (obj.className.indexOf('-selected') < 0)
	{
		obj.className = obj.className + '-selected';
	}
}

function menuOut(obj)
{
	if (obj.oldClass)
	{
		obj.className = obj.oldClass;
	}
}

function menuProjectsOver(obj)
{
	obj.oldClass = obj.className;
	if (obj.className.indexOf(' over') < 0)
	{
		obj.className = obj.className + ' over';
	}
}

function menuProjectsOut(obj)
{
	if (obj.oldClass)
	{
		obj.className = obj.oldClass;
	}
	else
	{
		obj.className = '';
	}
}

function menuDesignersOver(obj)
{
	obj.oldClass = obj.className;
	if (obj.className.indexOf(' over') < 0)
	{
		obj.className = obj.className + ' over';
	}
}

function menuDesignersOut(obj)
{
	if (obj.oldClass)
	{
		obj.className = obj.oldClass;
	}
	else
	{
		obj.className = '';
	}
}

function showProjectImage(project_id, id)
{
	var isFoundImage = true;
	var n = 1;
	
	while(isFoundImage)
	{
		obj = document.getElementById('project_image_' + project_id + '_' + n);
		obj_page = document.getElementById('project_image_page_' + project_id + '_' + n);
		if (obj)
		{
			if (parseInt(n) == parseInt(id))
			{
				obj.style.display = "block";
				obj_page.className = "page-num selected";
			}
			else
			{
				obj.style.display = "none";
				obj_page.className = "page-num";
			}
		}
		else
		{
			isFoundImage = false;
		}
		n++;
	}
}

function showFundsImage(id)
{
	var isFoundImage = true;
	var n = 1;
	
	while(isFoundImage)
	{
		obj = document.getElementById('funds_image_' + n);
		obj_page = document.getElementById('funds_image_page_' + n);
		if (obj)
		{
			if (parseInt(n) == parseInt(id))
			{
				obj.style.display = "block";
				obj_page.className = "page-num selected";
				document.getElementById('funds_image_name').innerHTML = document.getElementById('funds_image_name_' + n).innerHTML;
			}
			else
			{
				obj.style.display = "none";
				obj_page.className = "page-num";
			}
		}
		else
		{
			isFoundImage = false;
		}
		n++;
	}
}

function showProductImage(image)
{
	obj		= document.getElementById('gallery_big_image');
	obj_url	= document.getElementById('gallery_big_url');
	if (obj)
	{
		obj.src = 'Thumbnail.ashx?image=images/products/' + image + '&w=433&h=312&cp=1&rs=0&rb=1';
		obj_url.href = 'Thumbnail.ashx?image=images/products/' + image + '&w=1000&h=800&cp=1&rs=0&rb=1';
	}
}

function showGalleryImage(image)
{
	obj		= document.getElementById('gallery_big_image');
	obj_url	= document.getElementById('gallery_big_url');
	if (obj)
	{
		obj.src = 'Thumbnail.ashx?image=images/projects_images/' + image + '&w=433&h=312&cp=1&rs=0&rb=1';
		obj_url.href = 'Thumbnail.ashx?image=images/projects_images/' + image + '&w=1000&h=800&cp=1&rs=0&rb=1';
	}
}

function showHomeImage(image)
{
	obj		= document.getElementById('home_big_image');
	if (obj)
	{
		obj.src = 'Thumbnail.ashx?image=images/page_images/' + image + '&w=968&h=454&cp=1&rs=0&rb=1';
	}
}

function menuProductsCategoriesOver(obj)
{
	obj.oldClass = obj.className;
	if (obj.className.indexOf(' over') < 0)
	{
		obj.className = obj.className + ' over';
	}
}

function menuProductsCategoriesOut(obj)
{
	if (obj.oldClass)
	{
		obj.className = obj.oldClass;
	}
	else
	{
		obj.className = '';
	}
}

function showDesignerImage(image_id, lang_id)
{
	destination.push('designer_big_image');
	script_name = 'heb/_DesignerImage.aspx';
	ajax_req = 'image_id=' + image_id + '&lang_id=' + lang_id;
	cache.push(ajax_req);
	getAjaxRequest();
}

function showMap(id)
{
	obj = document.getElementById('div_map'+id);
	if (obj)
	{
		obj.style.display = 'block'; // 'block'
	}
}

function hideMap(id)
{
	obj = document.getElementById('div_map'+id);
	if (obj)
	{
		obj.style.display = 'none';
	}
}