function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); 
  return x;
}

// sends variables to flash:
function konaFlashHere(vidId)
{
	var isSWF = (vidId != "vid1");

	var fObj=MM_findObj(vidId);
	

	fObj.SetVariable("vidWidth",isSWF ? "300" : "180");
	fObj.SetVariable("vidHeight",isSWF ? "250" : "150");
	fObj.SetVariable("vidURL",!isSWF ? 
										"http://images.kontera.com/IMAGE_DIR/RM/Trunk_Monkey3.flv":
										"http://images.kontera.com/IMAGE_DIR/RM/Mac_Performance300250.swf");	
	fObj.SetVariable("vidThumb","");
	fObj.SetVariable("vidVolume","0");
	fObj.SetVariable("vidControls",""+!isSWF);
	fObj.SetVariable("vidButton",""+isSWF);
	fObj.SetVariable("vidAutoplay","true");
	fObj.SetVariable("vidCacheBusting","true");
	fObj.SetVariable("vidLoop","false");
	fObj.SetVariable("konaInfo","Testing~1~2~3");
	fObj.SetVariable("vidSimpleFlash",""+isSWF);
	fObj.SetVariable("vidStateCallback","false");
	// start the video:
	fObj.SetVariable("funcVar","loadFlash");
}

// activates functions in flash:
function set_flash(vidId, func)
{
	var fObj=MM_findObj(vidId);
	fObj.SetVariable("funcVar",func);
}

// All other functions operated by flash:
function setPercentage(vidId,num)
{
	//alert(num);
//	window.document.frm.txt.value+='\r'+num;
}

function setState(vidId,state)
{
	//alert(state);
	//window.document.frm.txt.value+='\r'+state;
}
function setType(vidId,type)
{
	//alert(type);
	//window.document.frm.txt.value+='\r'+type;
}
function setPlayTime(vidId,timems)
{
	//alert(timems);
	//window.document.frm.txt.value+='\r'+timems;
}
function setPlayLength(vidId,timems)
{
	//alert(timems);
	//window.document.frm.txt.value+='\r'+timems;
}
function setVidControls(vidId,cond)
{
	//alert(cond);
	//window.document.frm.txt.value+='\r'+cond;
}
function setVidButton(vidId,cond)
{
	//alert(cond);
	//window.document.frm.txt.value+='\r'+cond;
}
function setVidAutoplay(vidId,cond)
{
	//alert(cond);
	//window.document.frm.txt.value+='\r'+cond;
}
function setVidLoop(vidId,cond)
{
	//alert(cond);
	//window.document.frm.txt.value+='\r'+cond;
}
function setVolume(vidId,vol)
{
	//alert(vol);
	//window.document.frm.txt.value+='\r'+vol;
}
function setAccumulatedPlayedTime(vidId,timems)
{
	//alert("Time Played: "+timems);
	//window.document.frm.txt.value+='\r'+'Time Played: '+timems;
}
//-----------------------------------
function konaFlashClick(vidId)
{
	//alert('CLICK');
	//window.document.frm.txt.value+='\r'+'CLICK';
	var isSWF = (vidId != "vid1");
	var oWin;
	if (isSWF)
	{
        oWin = window.open("http://www.apple.com/dotmac/",null,"height=200,width=400,resizable=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes");
        if (oWin==null || typeof(oWin)=="undefined")
        {
            document.location.href="http://www.apple.com/dotmac/";
        }
	}
	else
	{
        oWin = window.open("http://www.chevrolet.com",null,"height=200,width=400,resizable=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes");
        if (oWin==null || typeof(oWin)=="undefined")
        {
            document.location.href="http://www.chevrolet.com";
        }
	}
}

function konaFlashStateChanged(vidId,oval,nval)
{
	//alert('State changed from '+oval+' to '+nval);
	//window.document.frm.txt.value+='\r'+'State changed from '+oval+' to '+nval;
}
function konaFlashError(vidId,str)
{
	//alert(str);
	//window.document.frm.txt.value+=str;
}


function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}


var flashToShow = new Array();
   function init()
   {
       for (var i = 0; i < flashToShow.length; i++)
       {
		showFlash(flashToShow[i][0], flashToShow[i][1], flashToShow[i][2], flashToShow[i][3], flashToShow[i][4], flashToShow[i][5], flashToShow[i][6]);				
       }
   }

var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}

