function GetXmlHttpObject()
{
	var xmlHttp = null;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function submit_search_form()
{
	//alert("Cauta: " + document.forms.search_f.search.value);
}

function print_page(link)
{
	windowW = 726;
	windowH = 800;
	windowX = (screen.width / 2) - (windowW / 2);
	windowY = (screen.height / 2) - (windowH / 2);
	var EB = window.open("printeaza-pagina.html?pagina=" + link, 
		"print_page", "width = " + windowW + ", height = " + windowH + 
		", fullscreen = 0, toolbar = 0, location = 0, directories = 0, status = 0, menubar = 0, scrollbars = yes, resizable = 0", 
		true);
	EB.resizeTo(windowW, windowH);
	EB.moveTo(windowX,windowY);
	EB.focus();
}

function popup_page(link, windowH, windowW)
{
	windowX = (screen.width / 2) - (windowW / 2);
	windowY = (screen.height / 2) - (windowH / 2);
	var EB = window.open(link, "print_page", "width = " + windowW + ", height = " + windowH + 
		", fullscreen = 0, toolbar = 1, location = 1, directories = 1, status = 1, menubar = 1, scrollbars = yes, resizable = 1", true);
	EB.resizeTo(windowW, windowH);
	EB.moveTo(windowX,windowY);
	EB.focus();
}

function check()
{
	alert("Formularul a fost trimis catre EURO-MOTOR. Va multumim.");
	document.location.href = base_href;
}


function popupPromoShow()
{
	Modalbox.show("_promo_popup.php?model=",
			{title: "Promo",
			width: 800 + 20,
			height: 490 + 70});
}

function gallery_zoom(title, model, id)
{
	if (model == "promo")
	{
		Modalbox.show("_promo_gal.php?id=" + id,
			{title: title,
			width: 800 + 20,
			height: 625 + 70});
	}
	else if (model == "limited")
	{
		Modalbox.show("_photo_gal.php?tip=lim&model=" + id,
			{title: title,
			width: 800 + 20,
			height: 620 + 70});
	}
	else
	{
		Modalbox.show("_photo_gal.php?tip=normal&model=" + id,
			{title: title,
			width: 800 + 20,
			height: 620 + 70});
	}
}

var images = [];
var images_pos = 0;
var images_count = 0;

function slide_next_img()
{
	if ((images_pos + 1) < images_count)
	{
		images_pos++;
	}
	else
	{
		images_pos = 0;
	}
	if (images[images_pos])
	{
		document.getElementById("slide_big_image").src = images[images_pos]["path"];
		document.getElementById("slide_big_href").href = base_href + images[images_pos]["orig_path"];
		document.getElementById("img_desc").innerHTML = images[images_pos]["info"];
	}
}

function slide_prev_img()
{
	if ((images_pos - 1) >= 0)
	{
		images_pos--;
	}
	else
	{
		images_pos = images_count - 1;
	}
	if (images[images_pos])
	{
		document.getElementById("slide_big_image").src = images[images_pos]["path"];
		document.getElementById("slide_big_href").href = base_href + images[images_pos]["orig_path"];
		document.getElementById("img_desc").innerHTML = images[images_pos]["info"];
//		document.getElementById("MB_caption").innerHTML = images[images_pos]["name"];
	}
}

var oss_timerid = 0;
var oss_status = "stop";

function play_pause_ss()
{
	if (oss_status == "stop")
	{
		oss_status = "play";
		document.getElementById("play_pause_ss").innerHTML = "Pause";
		slideshow_me();
	}
	else
		pause_ss();
}

function pause_ss()
{
	oss_status = "stop";
	document.getElementById("play_pause_ss").innerHTML = "Play";
	clearTimeout(oss_timerid);
	oss_timerid = 0;
}

function slideshow_me()
{
	slide_next_img();
	clearTimeout(oss_timerid);
	oss_timerid = setTimeout("slideshow_me()", 3000);
}

function modal_show_img(img, title, width, height)
{
	Modalbox.show("<center><img src='"+img+"' /></center>", {title: title, width: width, height: height});
}

function populateVersionSelect(id, sel_id)
{
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState == 4)
			document.nll.version.innerHTML = xmlHttp.responseText;
	}
	xmlHttp.open("GET", base_href + "__get_engines.php?id=" + id + "&sel_id=" + sel_id, true);
	xmlHttp.send(null);
}

function show_highslide(src, descr)
{
	var a_href = document.createElement('a');
	a_href.href = src;
	
	if (!hs.expand(a_href, { outlineType: 'rounded-white' }))
		window.setTimeout("hs.close(document.getElementById('highslide-wrapper-0'));", 5 * 1000);
}

