function MM_findObj(n, d) { //v3.0
  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);
  return x;
}

/* Functions that swaps images. */

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments;
  document.MM_sr=new Array;
  for(i=0;i<(a.length-2);i+=3)
    if( (x=MM_findObj(a[i])) != null) {
      document.MM_sr[j++]=x;
      if(!x.oSrc) x.oSrc=x.src;
      x.src=a[i+2];
    }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr;
  for(i=0; a && i<a.length && (x=a[i]) && x.oSrc; i++)
    x.src=x.oSrc;
}

/* Functions that handle preload. */

function MM_preloadImages() { //v3.0
  var d=document;
  if(d.images) {
    if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
    for(i=0; i<a.length; i++)
      if (a[i].indexOf("#") != 0) {
        d.MM_p[j]=new Image;
        d.MM_p[j++].src=a[i];
      }
  }
}

function preloadstuff()
{
MM_preloadImages('images/st1.JPG','images/st2.JPG','images/dl1.JPG','images/dl2.JPG','images/cu1.JPG','images/cu2.JPG');
MM_preloadImages('images/freedownloads/close.JPG','images/freedownloads/next.JPG');
}

function replaceimg(ctrl,img)
{
	ctrl.src = "http://localhost:8888/images/"+img;
	return false;
}

function BuyClip(id)
{			
  old1=document.myForm.os1.value;
  old2=document.myForm.shipping.value;
  old3=document.myForm.handling_cart.value;
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=6.99;
  document.myForm.os1.value="Download";
  document.myForm.shipping.value=0.00;
  document.myForm.handling_cart.value=0.00;
  document.myForm.submit();
  document.myForm.os1.value=old1;
  document.myForm.shipping.value=old2;
  document.myForm.handling_cart.value=old3;
}

function BuySClip(id,fmt)
{			
  old1=document.myForm.os1.value;
  old2=document.myForm.shipping.value;
  old3=document.myForm.handling_cart.value;
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=6.99;
  if (fmt!="PAL")
    fmt="NTSC";
  document.myForm.os0.value=fmt;
  document.myForm.os1.value="Download";
  document.myForm.shipping.value=0.00;
  document.myForm.handling_cart.value=0.00;
  document.myForm.submit();
  document.myForm.os1.value=old1;
  document.myForm.shipping.value=old2;
  document.myForm.handling_cart.value=old3;
}

function BuyClip2(id)
{			
  old1=document.myForm.os1.value;
  old2=document.myForm.shipping.value;
  old3=document.myForm.handling_cart.value;
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=9.99;
  document.myForm.os1.value="Download";
  document.myForm.shipping.value=0.00;
  document.myForm.handling_cart.value=0.00;
  document.myForm.submit();
  document.myForm.os1.value=old1;
  document.myForm.shipping.value=old2;
  document.myForm.handling_cart.value=old3;
}

function BuyClip3(id)
{			
  old1=document.myForm.os1.value;
  old2=document.myForm.shipping.value;
  old3=document.myForm.handling_cart.value;
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=14.99;
  document.myForm.os1.value="Download";
  document.myForm.shipping.value=0.00;
  document.myForm.handling_cart.value=0.00;
  document.myForm.submit();
  document.myForm.os1.value=old1;
  document.myForm.shipping.value=old2;
  document.myForm.handling_cart.value=old3;
}

function BuySClip2(id,fmt)
{			
  old1=document.myForm.os1.value;
  old2=document.myForm.shipping.value;
  old3=document.myForm.handling_cart.value;
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=9.99;
  if (fmt!="PAL")
    fmt="NTSC";
  document.myForm.os0.value=fmt;
  document.myForm.os1.value="Download";
  document.myForm.shipping.value=0.00;
  document.myForm.handling_cart.value=0.00;
  document.myForm.submit();
  document.myForm.os1.value=old1;
  document.myForm.shipping.value=old2;
  document.myForm.handling_cart.value=old3;
}

function BuySClip3(id,fmt)
{			
  old1=document.myForm.os1.value;
  old2=document.myForm.shipping.value;
  old3=document.myForm.handling_cart.value;
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=14.99;
  if (fmt!="PAL")
    fmt="NTSC";
  document.myForm.os0.value=fmt;
  document.myForm.os1.value="Download";
  document.myForm.shipping.value=0.00;
  document.myForm.handling_cart.value=0.00;
  document.myForm.submit();
  document.myForm.os1.value=old1;
  document.myForm.shipping.value=old2;
  document.myForm.handling_cart.value=old3;
}

function BuyVolume(id)
{			
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=59.99;
  document.myForm.submit();
}

function BuyABG(id, price)
{			
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=price;
  document.myForm.submit();
}

function BuySFC(id, price)
{			
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=price;
  document.myForm.submit();
}

function BuySTV(id, price)
{			
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=price;
  document.myForm.submit();
}

function BuyTape(id)
{			
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=59.99;
  document.myForm.submit();
}

function BuyDVD(id)
{			
  document.myForm.item_name.value=id;
  document.myForm.business.value="cdvpp@capitaldvstudio.com";
  document.myForm.amount.value=59.99;
  document.myForm.submit();
}

function ViewCart( )
{			
  document.VCForm.business.value="cdvpp@capitaldvstudio.com";
  document.VCForm.submit();
}

function preview( movfile )
{			
  document.myForm.fname.value="images/preview_newclips/"+movfile+".mov";
  window.open("qtpreview.htm","previewwnd","height=300,width=400,scrollbars=yes,resizable=yes,menubar=no")
}

function PrwABGV1( movfile )
{			
  document.myForm.fname.value="images/preview_clouds/clouds"+movfile+"pr.mov";
  window.open("qtpreview.htm","previewwnd","height=300,width=400,scrollbars=yes,resizable=yes,menubar=no")
}

function PrwClip(catid, volid, movfile, kwds )
{			
	ctrlid=catid+volid+0+((movfile<10)?("0"+movfile):(movfile));
	if (catid=="ABG")
		PrwABG(volid, movfile, ctrlid, kwds)
	else if (catid=="SFC")
		PrwSFC(volid, movfile, ctrlid, kwds)
	else if (catid=="FreeDL")
	{

	}
}

function nav(fmname)
{
   var w;
   var url_add;
	if (fmname=="SFCvlistform")
	{
   	w = document.SFCvlistform.vollist.selectedIndex;
   	url_add = document.SFCvlistform.vollist.options[w].value;
	}
	else if (fmname=="STVvlistform")
	{
   	w = document.STVvlistform.vollist.selectedIndex;
   	url_add = document.STVvlistform.vollist.options[w].value;
	}
	else if (fmname=="ALLvlistform")
	{
   	w = document.ALLvlistform.vollist.selectedIndex;
   	url_add = document.ALLvlistform.vollist.options[w].value;
	}
	else if (fmname=="PALvlistform")
	{
   	w = document.PALvlistform.vollist.selectedIndex;
   	url_add = document.PALvlistform.vollist.options[w].value;
	}
	else if (fmname=="NTSCvlistform")
	{
   	w = document.NTSCvlistform.vollist.selectedIndex;
   	url_add = document.NTSCvlistform.vollist.options[w].value;
	}
	else if (fmname=="FreeDLvlistform")
	{
   	w = document.FreeDLvlistform.vollist.selectedIndex;
   	url_add = document.FreeDLvlistform.vollist.options[w].value;
	}
	else
	{
   	w = document.ABGvlistform.vollist.selectedIndex;
   	url_add = document.ABGvlistform.vollist.options[w].value;
	}

   window.location.href = url_add;
}