function SymError()
{
  return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
  return (new Object());
}

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 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;
}

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;
}

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];}
}


var SymRealOnLoad;
var SymRealOnUnload;

function SymOnUnload()
{
  window.open = SymWinOpen;
  if(SymRealOnUnload != null)
     SymRealOnUnload();
}

function SymOnLoad()
{
  if(SymRealOnLoad != null)
     SymRealOnLoad();
  window.open = SymRealWinOpen;
  SymRealOnUnload = window.onunload;
  window.onunload = SymOnUnload;
}


        MenuFlag = 0;
        MenuCloseDelay = 1000;

        function setMenuFlagOn()
        {
                MenuFlag = 1;
        }

        function setMenuFlagOff()
        {
                MenuFlag = 0
        }

        function showMenu(o,html)
        {
                document.getElementById('CategoryMenuP').innerHTML = html

                var menu = document.getElementById('catmenu')

                menu.style.left = getAbsoluteLeft(o) + 75;
                menu.style.top = getAbsoluteTop(o);
                menu.style.visibility = 'visible';

                setMenuFlagOn();
                window.setTimeout('checkMenu()', MenuCloseDelay);
        }

        function getAbsoluteLeft(o)
        {
                oLeft = o.offsetLeft
                while(o.offsetParent!=null)
                {
                        oParent = o.offsetParent
                        oLeft += oParent.offsetLeft
                        o = oParent
                }
                return oLeft
        }
        function getAbsoluteTop(o)
        {
                oTop = o.offsetTop
                while(o.offsetParent!=null)
                {
                        oParent = o.offsetParent
                        oTop += oParent.offsetTop
                        o = oParent
                }
                return oTop
        }

        function hidemenu()
        {
                var menu = document.getElementById('catmenu')

                menu.style.visibility = 'hidden';

                setMenuFlagOff();
                //alert('jack');
        }

        function checkMenu()
        {
                var menu = document.getElementById('catmenu')

                if(MenuFlag == 0)
                {
                        menu.style.visibility = 'hidden';
                }
                else
                {
                        window.setTimeout('checkMenu()', MenuCloseDelay);
                }
        }


function submitloginform(email,password) {

         errorcode = 0;
         errortext='';
         loginform.email.style.backgroundColor = '' ;
         loginform.password.style.backgroundColor = '' ;

         if (email == '') { errorcode = 1};
         if (errorcode == 1) {errortext = "You did not enter an email address\n";
                              loginform.email.style.backgroundColor = '#fafccc'} ;
         if (password == '') { errorcode = 2};
         if (errorcode == 2) {errortext = errortext + "You did not enter a password" ;
                              loginform.password.style.backgroundColor = '#fafccc'} ;

         if (errorcode > 0) { alert (errortext) }
           else
           { document.loginform.submit() }  ;
}


function submitregform() {

         var x = document.getElementById('b');
         x.style.color = '';

         errorcode = 0;
         errortext='';
         regform.custcontact.style.backgroundColor = '' ;
         regform.custname.style.backgroundColor = '' ;
         regform.custadd1.style.backgroundColor = '' ;
         regform.custadd2.style.backgroundColor = '' ;
         regform.custadd3.style.backgroundColor = '' ;
         regform.custadd4.style.backgroundColor = '' ;
         regform.custpost.style.backgroundColor = '' ;
         regform.custcountry.style.backgroundColor = '' ;
         regform.custphone1.style.backgroundColor = '' ;
         regform.custphone2.style.backgroundColor = '' ;
         regform.custemail.style.backgroundColor = '' ;
         regform.custpass.style.backgroundColor = '' ;
         regform.custpass2.style.backgroundColor = '' ;
         regform.custreminder.style.backgroundColor = '' ;
         regform.custterms.style.backgroundColor = '' ;

         if (regform.custcontact.value == '') { errorcode = 1;
              regform.custcontact.style.backgroundColor = '#fafccc'} ;
         if (regform.custname.value == '') { errorcode = 1;
              regform.custname.style.backgroundColor = '#fafccc'} ;
         if (regform.custadd1.value == '') { errorcode = 1;
              regform.custadd1.style.backgroundColor = '#fafccc'} ;
         if (regform.custadd3.value == '') { errorcode = 1;
              regform.custadd3.style.backgroundColor = '#fafccc'} ;
         if (regform.custadd4.value == '') { errorcode = 1;
              regform.custadd4.style.backgroundColor = '#fafccc'} ;
        if (regform.custpost.value == '') { errorcode = 1;
              regform.custpost.style.backgroundColor = '#fafccc'} ;
         if (regform.custcountry.value == '') { errorcode = 1;
              regform.custcountry.style.backgroundColor = '#fafccc'} ;
         if (regform.custphone1.value == '') { errorcode = 1;
              regform.custphone1.style.backgroundColor = '#fafccc'} ;
         if (regform.custemail.value == '') { errorcode = 1;
              regform.custemail.style.backgroundColor = '#fafccc'} ;
         if (regform.custpass.value == '') { errorcode = 1;
              regform.custpass.style.backgroundColor = '#fafccc'} ;
         if (regform.custpass2.value == '') { errorcode = 1;
              regform.custpass2.style.backgroundColor = '#fafccc'} ;
         if (regform.custreminder.value == '') { errorcode = 1;
              regform.custreminder.style.backgroundColor = '#fafccc'} ;
         if (regform.custterms.checked == false) { errorcode = 1;
              x.style.color = '#ff0000';
              regform.custterms.style.backgroundColor = '#fafccc'} ;


         if (errorcode == 1) {errortext = "Please fill in the required fields\n"};

         if (errorcode > 0) { alert (errortext); }
           else if (regform.custpass.value != regform.custpass2.value) { //check both passwords are the same
           errortext = "Your 2 passwords do not match, please re-type and confirm";
           regform.custpass.style.backgroundColor = '#fafccc' ;
           regform.custpass2.style.backgroundColor = '#fafccc' ;
           alert (errortext)
          }
           else { document.regform.submit(); }  ;

}

function myprint()
{
window.print();
}

	var lastmenu;

function quickorderhide() {

	var cells = document.getElementsByName(lastmenu);

	for(j = 0; j < cells.length; j++)
 	cells[j].style.display="none";

	}

function quickordershow(btn) {
	quickorderhide();    lastmenu = 'l' + btn;

	var cells = document.getElementsByName('l' + btn);

	for(j = 0; j < cells.length; j++)
 	cells[j].style.display="block";

	}









