var clientPC = navigator.userAgent.toLowerCase (); // Get client info
var clientVer = parseInt (navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

function getSelectBoxOption (ArrayName, BoxObj, DefaultValue)
{

   if ( (typeof (ArrayName) == "undefined") || (typeof (BoxObj) == "undefined") )
   {

      return false;

   }

   for (var i = BoxObj.options.length-1 ; i >= 0 ; i--)
   {

       BoxObj.options[i] = null;

   }

   for (var i = 0 ; i < ArrayName.length ; i++)
   {

       BoxObj.options[i] = new Option(ArrayName[i].text, ArrayName[i].value);

       if (ArrayName[i].value == DefaultValue)
       {

          BoxObj.options[i].selected = true;

       }

   }

}


function getPostcode (PostcodeArray, CityVar, AreaVar)
{

   if (typeof (PostcodeArray) == "undefined")
   {

      return "";

   }

   return PostcodeArray[CityVar][AreaVar];

}


function redirect (ArrayName, Obj, SelectVar)
{

   if ( (typeof (Obj) == "undefined") || (typeof (ArrayName) == "undefined") )
   {

      return false;

   }

   for (var i = Obj.options.length-1 ; i >= 0 ; i--)
   {

       Obj.options[i] = null;

   }

   for (var i = 0 ; i < ArrayName.length ; i++)
   {

       Obj.options[i] = new Option(ArrayName[i].text, ArrayName[i].value);

       if (ArrayName[i].value == SelectVar)
       {

          Obj.options[i].selected = true;

       }

   }

}


function setCheckBox (FormObj, CheckboxName, Logic)
{

   var cbs = FormObj.elements[CheckboxName];

   if (typeof (cbs) != "undefined")
   {

      if (typeof (cbs.length) == "undefined")
      {

         cbs.checked = Logic;

      }

      else
      {

         for (var i = 0 ; i < cbs.length ; i++)
         {

             cbs[i].checked = Logic;

         }

      }

   }

}


function OpenPopupWindow (WindowUrl, WindowName, WindowWidth, WindowHeight, WindowTop, WindowLeft, WindowStatus, WindowScrollbars, WindowResizable)
{

   WindowName = ( ( typeof (WindowName) == "undefined") || (WindowName == "") ) ? "PopupWindow" : WindowName;
   WindowWidth = ( (typeof (WindowWidth) == "undefined") || (WindowWidth == "") ) ? 0 : WindowWidth;
   WindowHeight = ( (typeof (WindowHeight) == "undefined") || (WindowHeight == "") ) ? 0 : WindowHeight;
   WindowTop = ( (typeof (WindowTop) == "undefined") || (WindowTop == "") ) ? ( (eval (WindowHeight) == 0) ? 0 : (((screen.availHeight - WindowHeight) - ((screen.availHeight - WindowHeight) % 2)) / 2) ) : WindowTop;
   WindowLeft = ( (typeof (WindowLeft) == "undefined") || (WindowLeft == "") ) ? ( (eval (WindowWidth) == 0) ? 0 : (((screen.availWidth - WindowWidth) - ((screen.availWidth - WindowWidth) % 2)) / 2) ) : WindowLeft;
   WindowStatus = ( (typeof (WindowStatus) == "undefined") || (WindowStatus == "") ) ? "" : WindowStatus;
   WindowScrollbars = ( (typeof (WindowScrollbars) == "undefined") || (WindowScrollbars == "") ) ? "" : WindowScrollbars;
   WindowResizable = ( (typeof (WindowResizable) == "undefined") || (WindowResizable == "") ) ? "" : WindowResizable;

   var WindowConfig = "";

   WindowConfig = ( (eval (WindowWidth) == 0) ? "" : "width=" + eval (WindowWidth) + "px" );
   WindowConfig += ( (eval (WindowHeight) == 0) ? "" : ( (WindowConfig == "") ? "" : ", " ) + "height=" + eval (WindowHeight) + "px" );
   WindowConfig += ( (WindowConfig == "") ? "" : ", " ) + ( (eval (WindowTop) == 0) ? "top=" + ((screen.availHeight - (screen.availHeight % 2)) / 2) + "px" : "top=" + eval (WindowTop) + "px" );
   WindowConfig += ( (eval (WindowLeft) == 0) ? "" : ( (WindowConfig == "") ? "" : ", " ) + "left=" + eval (WindowLeft) + "px" );
   WindowConfig += ( (WindowStatus == "") ? "" : ( (WindowConfig == "") ? "" : ", " ) + "status=" + WindowStatus );
   WindowConfig += ( (WindowScrollbars == "") ? "" : ( (WindowScrollbars == "") ? "" : ", " ) + "scrollbars=" + WindowScrollbars );
   WindowConfig += ( (WindowResizable == "") ? "" : ( (WindowResizable == "") ? "" : ", " ) + "resizable=" + WindowResizable );

   window.open (WindowUrl, WindowName, WindowConfig);

}

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_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_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];}
}
//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com


function changeImg (DivName, ImgUrl, HrefTarget, ImgSrc, ImgWidth, ImgHeight, ImgTitle, ImgAlt)
{

   if (document.getElementById(DivName))
   {

      document.getElementById(DivName).innerHTML = (( (ImgUrl != '') ? '<a href="' + ImgUrl + '" target="' + ( (HrefTarget != '') ? HrefTarget : '_blank' ) + '" title="' + ImgTitle + '">' : '' ) + '<img src="' + ImgSrc + '" width="' + ImgWidth + '" height="' + ImgHeight + '" border="0" title="' + ImgTitle + '" alt="' + ImgAlt + '" style="border: 1px solid #CCCCCC;" />' + ( (ImgUrl != '') ? '</a>' : '' ));

   }

}


function changeTextUrl (DivName, TextUrl, HrefTarget, TextContent, TextTitle)
{

   if (document.getElementById(DivName))
   {

      document.getElementById(DivName).innerHTML = (( (TextUrl != '') ? '<a href="' + TextUrl + '" target="' + ( (HrefTarget != '') ? HrefTarget : '_blank' ) + '" title="' + TextTitle + '">' : '' ) + TextContent + ( (TextUrl != '') ? '</a>' : '' ));

   }

}


function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function confirmMsg (msg)
{

   //var ReturnAns;
   return confirm (msg);

}
