
function set_main_image(idx)
{
	var image_collection = Array("/image.php?g=17668bcf-83d5-8d45-80d1-d58ea637067c", "/image.php?g=e51d245a-817e-4803-601e-e176f0487b7e", "/image.php?g=d4421ec8-2147-aaaa-e600-85d9281fccfd", "/image.php?g=c7e776d8-22ef-50c8-385f-9a382558f2ea");

	if (img = document.getElementById('mainImage'))
	{
		img.src = image_collection[idx] + '&of=1';
	}

	for (i = 0; i < image_collection.length; i++)
	{
		if (img = document.getElementById('thumbNail' + i))
		{
			img.className = (i == idx)? "selected" : null;
		}
	}
}

function advert_tabs_set_tab(tab, tabName, divClass)
{
	var i = 0;
	var tr = tab.parentNode;
	for (var j = 0; j < tr.childNodes.length; j++)
	{
		if (tr.childNodes[j].className && (tr.childNodes[j].className != "tab last"))
		{
			td = tr.childNodes[j];
			td.className = "tab" + ((td == tab)? " selected" : "");

			if (div = document.getElementById(tabName + '_' + i))
			{
				div.className = divClass + ((td == tab)? " selected" : "");
			}
			i++;
		}
	}
}

function advert_tabs_select(tabId, caption, body)
{
	if (td = document.getElementById('td_' + caption + '_' + tabId))
	{
		advert_tabs_set_tab(td, caption, "caption");
	}
	if (td = document.getElementById('td_' + body + '_' + tabId))
	{
		advert_tabs_set_tab(td, body, "body");
	}
}




/*
 Microsoft Virtual Earth
 */

var map = null;
var point = null;
var mapContainer = 'mapContainer';

function EventMouseWheel(e)
{
   //insert custom behavior here...
   //return true to disable the default behavior. return false to enable the default behavior.
	window.scrollBy(0,-1*e.mouseWheelChange);
  	return true;
}

function init_ve_map()
{
	// create a new map
	map = new VEMap(mapContainer);

	// set dashboard size
	map.SetDashboardSize(VEDashboardSize.Small);

	// get map style
	version_info = VEMap.GetVersion().split('.');
	map_style = (version_info[2] >= 20070400000000)? VEMapStyle.Shaded : VEMapStyle.Road;

	// initialize map
	map.LoadMap(point, 10, map_style, false, VEMapMode.Mode2D, false);

	// Disable mouse wheel
       map.AttachEvent("onmousewheel", EventMouseWheel);

	// create new marker
	var marker = new VEShape(VEShapeType.Pushpin, point);
	marker.SetCustomIcon('<img src="./images/map/house.gif" alt="" style="margin: 5px 0px 0px 7px;" />');
	
	// add marker
	map.AddShape(marker);

	map.AttachEvent("onmouseover", function(e) {if (e.elementID != null) {return true;}});
	map.AttachEvent("onmouseout", function(e) {if (e.elementID != null) {return true;}});

	// hide elements of the map
	if (div = document.getElementById(mapContainer))
	{
		var nodes = div.getElementsByTagName("div");
		
		for (i = 0; i < div.childNodes.length; i++)
		{
			var child = div.childNodes[i];

			if ((child.className != null) && (
			 (child.className.indexOf("MSVE_Scale") == 0) || 
			 (child.className.indexOf("MSVE_Powered") == 0) ||
				(child.className.indexOf("MSVE_Copyright") == 0)))
			{
				child.style.display = "none";
			}
		}
	}

}