// Created: 09 August 2006 16:04
// Author: Adrian Jenkins
// Copyright © 2006 Cyber-Media Solutions

var xmlHttp = null;
var lastImage = -1;

function changeImage(content_id, num) {
	if ( content_id > -1 && ( num == 1 || num == 2 || num == 3) && (lastImage == -1 || lastImage != num ) ) { 
		var url="front_support.php?Mode=get_image_url&sid=" + Math.random() + "&id=" + content_id + "&num=" + num;
		xmlHttp=GetXmlHttpObject(changeImage_stateChanged);
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
		lastImage = num;
	} 
} 

function changeImage_stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		if ( xmlHttp.responseText != '') {
			document.getElementById("prodsV").innerHTML = xmlHttp.responseText;
		}
	} 
} 

function GetXmlHttpObject(handler) { 
	var objXmlHttp=null;

	if (navigator.userAgent.indexOf("MSIE")>=0) { 
		var strName="Msxml2.XMLHTTP";

		if (navigator.appVersion.indexOf("MSIE 5.5")>=0) {
			strName="Microsoft.XMLHTTP";
		} 
		try { 
			objXmlHttp=new ActiveXObject(strName);
			objXmlHttp.onreadystatechange=handler;
			return objXmlHttp;
		} 
		catch(e) { 
			alert("Error. Scripting for ActiveX might be disabled");
			return 
		} 
	} 

	if (navigator.userAgent.indexOf("Mozilla")>=0 || navigator.userAgent.indexOf("Opera")>=0 ) {
		objXmlHttp=new XMLHttpRequest();
		if ( handler != null ) {
			objXmlHttp.onload=handler;
			objXmlHttp.onerror=handler;
		}
		return objXmlHttp;
	}
} 


function activateFlash()
{
	// If the browser is Internet Explorer, version 4.0 or more recent, ...
	if (navigator.userAgent.indexOf("MSIE") >= 0 && navigator.appVersion.indexOf("4.0") >= 0)
	{
		// Look for any object tags declared within the current page and store them in an array
		var theObjects = document.getElementsByTagName("object");

		// Loop through each object tag ...
		for (var i = 0; i < theObjects.length; i++)
		{
			var continueSearch = true;
		
			// Get the parameter tags specified for the object
			var childNodes = theObjects[i].childNodes;

			// Loop through each parameter tag ...
			for (var j = 0; j < childNodes.length && continueSearch; j++)
			{
				// Get the value of each parameter
				var childNodeValue = childNodes[j].getAttribute("value");

				if (childNodeValue != null && childNodeValue.indexOf(".swf") > 0)
				{
					// If the object is a Flash movie file,
					// prevent the need for users to double-click the object in order to activate it

					theObjects[i].outerHTML = theObjects[i].outerHTML;
					continueSearch = false;
				}
			}
		}
	}
}

