var f = 0;
var c = 0;
var u = 1;
var pe = 'berny@adeptgraphics.com.au';

function p(_f,_c,_u)
{
   if (_f!==false)
   {
      f = _f;
      if (_u)
      {
         var s = domID('size').childNodes;
         var t = s.length;
         for (var i=0; i<t; i++)
         {
            if (s[i].value.charAt(0)==_f)
            {
               domID('size').selectedIndex = i;
               a(false);
               break;
            }
         }
      }
   }
   if (_c!==false)
   {
      c = _c;
      if (_u)
      {
         var s = domID('colour').childNodes;
         var t = s.length;
         for (var i=0; i<t; i++)
         {
            if (s[i].value.charAt(0)==_c)
            {
               domID('colour').selectedIndex = i;
               break;
            }
         }
      }
   }
   var ch = domID('i').childNodes;
   var t = ch.length;
   for (var i=0; i<t; i++)
      if (ch[i].nodeType==1)
         ch[i].style.display = 'none';
   if (domID('i'+ f + c))
      domID('i'+ f + c).style.display = 'block';
   return false;
}

function pp(_v)
{
   if (_v)
   {
      var l = 'https://www.paypal.com/cgi-bin/webscr?cmd=_cart';
      l += '&business='+ escape(pe);
      l += '&currency_code=AUD';
      l += '&display=1';
      l += '&shopping_url='+ escape(document.location.href);
   } else {
      var l = 'https://www.paypal.com/cgi-bin/webscr?cmd=_cart';
      l += '&business='+ escape(pe);
      l += '&currency_code=AUD';
      l += '&no_shipping=2';
      l += '&item_name='+ escape(domID('product').value)  +'&item_number='+ escape(domID('number').value);
      l += '&on0=Colour';
      l += '&os0='+ escape(sV('colour').split('|')[1]);
      l += '&on1=Size';
      l += '&os1='+ escape(sV('size').split('|')[3]);
      l += '&on2=Finish';
      l += '&os2='+ escape(sV('finish').split('|')[1]);
      l += '&amount='+ escape(sV('size').split('|')[u]);
      l += '&add=1';
      l += '&shopping_url='+ escape(document.location.href);
   }
   document.location.href = l;
   return false;
}

function sV(p)
{
   return domID(p)[domID(p).selectedIndex].value;
}

function s(_f, _c)
{
   if (_f!==false)
      _f = _f.split('|')[0];
   if (_c!==false)
      _c = _c.split('|')[0];
   void(p(_f,_c));
}

function a( _u)
{
   if (_u !== false)
      u = _u.split('|')[0];
   var x = sV('size');
   domID('amount').value = '$'+ x.split('|')[u] +' AUD';
}

function pop()
{
   if (domID('i'+ f + c))
   {
      var s = domID('i'+ f + c).childNodes[0].childNodes[0].src.replace('145-','').replace('\.png','');
      var p = window.open(s, 'popwin','status=0,toolbar=0,location=0,menubar=0,resizeable=0,scollbars=0,height=510,width=510');
   }
}

function domID(i)
{
   if (document.getElementById(i))
      return document.getElementById(i);
   return false;
}

function prl()
{
   for (var i=0; i<pre.length; i++)
   {
      var p = document.createElement('img');
      p.src = pre[i];
   }
}

function pr(i)
{
   domID('portfolio').src = pre[i];
}

