// JavaScript Document
  function PP_preloadImages()
  {
    if( document.images )
    {
      var preLoadArg = PP_preloadImages.arguments;

      var arrayImages = new Array();

      for( var i = 0; i < preLoadArg.length; i++ )
      {
        arrayImages[i] = new Image();
        arrayImages[i].src = preLoadArg[i];
      }
    }
  }

  function locateObject(name, d)
  {
    var i,x;
    if( !d ) d = document;
  	 x = d[name];
    for(i=0; !x && d.layers && i< d.layers.length; i++)
      x=locateObject(name, d.layers[i].document);
    return x;
  }

  function ImageSwap( Name, URL)  {
    var img;
    img = locateObject(Name);
    img.src = URL;
  }

  
function ajaxFunction(in_event, in_pos)
{
	var xmlHttp;

	try
  	{  // Firefox, Opera 8.0+, Safari  
		xmlHttp=new XMLHttpRequest();  
	}
	catch (e)
	{  // Internet Explorer  
		try
		{    
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
		}
  		catch (e)
	    {    
			try
			{      
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");      
				return false;      
			}    
		}  
	}

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('thumbspace').innerHTML = (xmlHttp.responseText);
		}
	}
	url = "thumbs.php?event=" + in_event + "&pos=" + in_pos;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

function ajaxCart(inAction,inEvent,inImg)
{
var xmlHttp;

	try
  	{  // Firefox, Opera 8.0+, Safari  
		xmlHttp=new XMLHttpRequest();  
	}
	catch (e)
	{  // Internet Explorer  
		try
		{    
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
		}
  		catch (e)
	    {    
			try
			{      
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");      
				return false;      
			}    
		}  
	}

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('addtocart').innerHTML = (xmlHttp.responseText);
		}
	}
	

	if (inAction == 'Submit') 
	{
		url = "cart.php?event=" + inEvent + "&img=" + inImg + "&action=" + inAction;
	}
	else
	{
		url = "cart.php";
	}
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);  
}

function show_pic(inpic,pos) {
  document.getElementById('pic_id').src = inpic;
  picIndex = pos;
  show_desc();
}

function next_pic()
{
	picIndex++;
	show_pic(picSource[picIndex],picIndex);
	show_desc();
//	this is used for the purchase button?
//	document.getElementById('frmPicture').value = picSource[picIndex];
}

function prev_pic()
{
	picIndex--;
	show_pic(picSource[picIndex],picIndex);
	show_desc();
}

function show_desc()
{
	if (picIndex == 0)
	{
		document.getElementById('eventDesc').style.visibility = 'visible';
		document.getElementById('prev_arrow').style.visibility = 'hidden';
	}
	else
	{
		document.getElementById('eventDesc').style.visibility = 'hidden';
		document.getElementById('prev_arrow').style.visibility = 'visible';
	}
	
}

function loadFlash(swf,width,height,FlashVars)
{
	AC_FL_RunContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
		'width', width,
		'height', height,
		'src', swf,
		'quality', 'high',
		'pluginspage', 'http://www.adobe.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'true',
		'scale', 'showall',
		'devicefont', 'false',
		'id', swf,
		'bgcolor', '#000000',
		'name', swf,
		'menu', 'true',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', swf,
		'FlashVars', FlashVars,
		'salign', ''
		);


	document.write('<noscript>');
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width='+width+' height='+height+' id="'+swf+'" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="beta/'+swf+'.swf" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="bgcolor" value="#000000" />');
	document.write('<embed src="beta/'+swf+'.swf" quality="high" wmode="opaque" bgcolor="#000000" width='+width+' height='+height+' name="header01" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />');
	document.write('</object>');
	document.write('</noscript>');

}

function noflash()
{
	document.write('no flash!');
}
