var xmlHttp
var divContainer
divContainer = "products";
function showProducts(b)
{ 
	var url="productlist.php?sid=" + Math.random() + "&b=" + b
	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null);
	return false;
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById(divContainer).innerHTML=xmlHttp.responseText 
	} 
	else
		document.getElementById(divContainer).innerHTML="<img src='images/loading.gif' border='0'>";
} 

function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This example doesn't work in Opera") 
		return 
	}
	
	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)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
}

function popWindow(picname,wid,hyt)
{
	myURL = 'newsimage.php?pname=' + picname;
	myFeatures = 'left=20,top=20,width=' + wid + ', height=' + hyt + ',toolbar=1,resizable=0'
	myRef = window.open(myURL ,'mywin',myFeatures);
	myRef.focus();
}

function embedFlashObject(swf)
{
	
	switch(swf)
	{
		case 'products':
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="840" height="560" id="murillo_products" align="middle">\n');
		   document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
		   document.write('<param name="movie" value="murillo_products.swf?cat=' + pCat + '" />\n');
		   document.write('<param name="quality" value="high" />\n');
		   document.write('<param name="bgcolor" value="#ffffff" />\n');
		   document.write('<embed swLiveConnect=true src="murillo_products.swf?cat=' + pCat + '" quality="high" bgcolor="#ffffff" width="840" height="560" name="murillo_products" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
		   document.write('</object>\n');
		break;
		
		case 'showroom':
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="500" height="480" id="showroom" align="middle">\n');
		   document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
		   document.write('<param name="movie" value="showroom.swf" />\n');
		   document.write('<param name="quality" value="high" />\n');
		   document.write('<param name="bgcolor" value="#ffffff" />\n');
		   document.write('<embed src="showroom.swf" quality="high" bgcolor="#ffffff" width="500" height="480" name="showroom" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
		   document.write('</object>\n');
		break;
	}
   
}

var movieName = "murillo_products";

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  }	else {
    return document[movieName]
  }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}

function golabel() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).TGotoLabel("_level0/","redframe");
  }
}

function setVar(mcVar, val)
{
if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).SetVariable("/"+mcVar, val);
  }

}

function gotoFrameLabel(frName)
{
	if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).TCallLabel("/",frName);
  	}
}

function setHtmlById(divName, divStr)
{
	document.getElementById(divName).innerHTML = divStr;	
}

function getHtmlById(divName)
{
	return document.getElementById(divName).value;
}

function setHtmlByIdValue(divName, val)
{
	document.getElementById(divName).value = val;
}