/* Single script to combine:
<script language="JavaScript" type="text/javascript" src="/external/pegJSincludes.js"></script>
<script language="JavaScript" type="text/javascript" src="/external/pgcsformval.js"></script>
<script language="JavaScript" type="text/javascript" src="/external/pgcsflashcheck.js"></script>
<script language="JavaScript" type="text/javascript" src="/external/pgcscornerfy.js"></script>

Requested by Jen Harley on 9/11/2011:
Combine 4 external javascripts into 1 (line 13 – 16 when you view Source code) It’s quicker for Google to read 1 file	
*/

// ================================================================================================ //
// pegJSincludes.js
// ================================================================================================ //
//template functions - do not remove
//----------------------------------
/*
function checkSearchString(f){
        var r, re;
        re = new RegExp("[#&£$]");
        r = f.match(re);
        if(r=="#" || r == "&" || r == "£" || r == "$"){
                alert("Please do not include the character " + r + " within your search");
                return false;
        }
        else
        {
                return true;
        }
}
*/

function checkIncidentSearchCallRef(f){
        var r, re;
        re = new RegExp("[^0-9]");
        r = f.match(re);
        if(r!=null){
                alert("Please only include numbers in the Call Reference field");
                return false;
        }
        else
        {
                return true;
        }
}

function checkSearchString(f){
        if (f.length == 1){
                alert("Please ensure that your search is for more than one character")
                f.value = "";
        }
        else
        {
                var r, re;
                re = new RegExp("[^a-zA-Z0-9' .]");
                r = f.match(re);
                if(r!=null){
                        alert("Please only include the characters 0-9 and a-z in your search");
                        return false;
                }
                else
                {
                        return true;
                }
        }
}

function checkQuickSearch(f){
    if (f.txtQuickSearch.value == "" || f.txtQuickSearch.value == "Enter search text:"){
        alert("You cannot submit a blank search");
        }
    else{
    if(checkSearchString(f.txtQuickSearch.value) == true){
                var searchString;
                if(f.txtQuickSearch.value.indexOf(".") > -1){
                        if(f.txtQuickSearch.value.charAt(0) != "0"){
                                searchString = "0" + f.txtQuickSearch.value;
                        }
                        else
                        {
                                searchString = f.txtQuickSearch.value;
                        }
                }
                else
                {
                        searchString = f.txtQuickSearch.value;
                }
                if (f.cboSearch.value == "all"){
                    window.location.href="/search.asp?submit=search&stype=1&pterm=" + searchString + "&last=11&Term=" + searchString + "&qlink=" + f.allCols.value + "~dt=an~qt=" + searchString + "~rf=0";
                    }
                else{
                    window.location.href="/search.asp?submit=search&pterm=" + searchString + "&last=11&Term=" + searchString + "&qlink=~col=" + f.cboSearch.value + "~dt=an~qt=" + searchString + "~rf=0";
                }
        }
    }
}

function checkSearch(f){
    if (f.txtSearch.value == "" || f.txtSearch.value == "Enter search text:"){
        alert("You cannot submit a blank search");
        }
    else{
    if(checkSearchString(f.txtSearch.value) == true){
                var searchString;
                if(f.txtSearch.value.indexOf(".") > -1){
                        if(f.txtSearch.value.charAt(0) != "0"){
                                searchString = "0" + f.txtSearch.value;
                        }
                        else
                        {
                                searchString = f.txtSearch.value;
                        }
                }
                else
                {
                        searchString = f.txtSearch.value;
                }
                if (f.cboSearch.value == "all"){
                    window.location.href="/search.asp?submit=search&stype=1&pterm=" + searchString + "&last=11&Term=" + searchString + "&qlink=" + f.allCols.value + "~dt=an~qt=" + searchString + "~rf=0";
                    }
                else{
                    window.location.href="/search.asp?submit=search&pterm=" + searchString + "&last=11&Term=" + searchString + "&qlink=~col=" + f.cboSearch.value + "~dt=an~qt=" + searchString + "~rf=0";
                }
        }
    }
}

function checkCorpSearch(f){
        f = document.getElementById(f);
        if (f.txtSearch.value == ""){
                alert("You cannot submit a blank search");
        }
        else
        {
                if(checkSearchString(f.txtSearch.value) == true){
                        var searchString;
                        searchString = f.txtSearch.value;
                        window.location.href = "/search.asp?submit=search&last=11&Term=" + searchString + "&page=search.asp";
                }

        }
}

function checkPostcodeSearch(f){
    if (f.text_postcode.value != "" && f.text_postcode.value.length > 1){
        return true;
        }
    else{
        alert("You cannot submit a blank search.\nPlease enter your postcode.");
        return false;
    }
}

function Navigate2(f){
    if (f.txtEmail.value != ""){
        return true;
        }
    else{
        alert("You cannot submit a blank E-mail address");
        return false;
    }
}

function MM_swapImgRestore(){
  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){
  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;
}

function MM_swapImage(){
  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];}
}

//corporate template functions
//--------------------------

// Sets 'I need Solutions for' form action to the selected solution and submits the form
function selectSolution(obj){
        document.getElementById("solutions").action = 'content.asp?PageId=' + obj.options[obj.selectedIndex].value;
        document.getElementById("solutions").submit(document.getElementById("solutions"));
}

// Sets 'I need Events that cover' form action to the selected solution and submits the form
function selectEvent(obj){
        document.getElementById("events").action = 'content.asp?PageId=1507&productFilter=' + obj.options[obj.selectedIndex].value;
        document.getElementById("events").submit(document.getElementById("events"));
}

function Hide(obj){
        document.getElementById(obj).style.display = "none";
}

function Show(obj){
        document.getElementById(obj).style.display = "";
}

function ShowHide(obj){
        document.getElementById(obj).style.display=(document.getElementById(obj).style.display!="none")? "none" : "";
}

function getMovie(file,title){
        var so = new SWFObject(file, title, "600", "400", "7", "#a0a9bf");
        so.write("divDemo");
        document.getElementById("divDemo").style.display = "";
}

function openMovie2(){
        document.getElementById("divDemo").style.display = "";
}

function closeMovie2(page){
        var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
        if(InternetExplorer){
                window.location = "/content.asp?PageId=" + page
        }
        else{
                document.getElementById("divDemo").style.display = "none";
        }
}

//corporate find a partner functions
//----------------------------------

// This jumps the region list to the requested index number
function bp_jumpyList(num){
        document.getElementById("select_region").selectedIndex = num;
}

// Updated "jump-to region" function
function selectRegion(obj){

        var regtext = obj.options[obj.selectedIndex].text;
        var id = obj.value;

        if(id != "-1"){
                window.location = "/content.asp?PageId=1502&id=" + id + "&r=" + regtext;
        }
}

/*function selectRegion(reg,regtext){
        if(reg.value != "-1"){
                window.navigate("/content.asp?PageId=1502&id=" + reg.value + "&r=" + regtext);
        }
}*/

//references.asp (and wp_survey.asp) functions
//--------------------------------------------

function maxLength(field, countfield, maxlimit){
    // if too long...trim it!
    if (field.value.length > maxlimit){
        field.value = field.value.substring(0, maxlimit);
        }
    // otherwise, update 'characters left' counter
    else{
        countfield.value = maxlimit - field.value.length;
    }
}

function move(fbox,tbox) {
    tbox.value = "";
    var txtStr = "";
    for(var i=0; i<fbox.options.length; i++) {
        if(fbox.options[i].selected && fbox.options[i].value != "") {
            txtStr = txtStr + fbox.options[i].value + ", ";
            tbox.value = txtStr;
        }
    }
}

//reseller_app.asp functions
//--------------------------

function amendList(){
    var boxLength = document.form1.listCont.length;
    var selectedItem = document.form1.cboSoft.selectedIndex;
    var selectedText = document.form1.cboSoft.options[selectedItem].text + ", ";
    var selectedValue = document.form1.cboSoft.options[selectedItem].value;
    var i;
    var isNew = true;
    if (boxLength != 0) {
        for (i = 0; i < boxLength; i++) {
        thisitem = document.form1.listCont.options[i].text;
        if (thisitem == selectedText) {
            isNew = false;
            break;
            }
        }
    }
    if (form1.cboSoft.value != "-1"){
        if (isNew) {
            newoption = new Option(selectedText, selectedValue, false, false);
            document.form1.listCont.options[boxLength] = newoption;
            form1.listcont2.value = form1.listcont2.value + selectedText;
            }
        }
     form1.txtSoft.value = form1.listcont2.value;
}

function resetList(){
    form1.listCont.innerHTML = "";
    form1.listcont2.value = "";
    form1.txtSoft.innerHTML = "";
    form1.cboSoft.value = "-1";
}

//Added by NV 28/05/2010 - reseller_app.asp 
//-----------------------------------------

function amendList2(){
    var boxLength = document.form1.listCont.length;
    var selectedItem = document.form1.cboPegSoft.selectedIndex;
    var selectedText = document.form1.cboPegSoft.options[selectedItem].text + ", ";
    var selectedValue = document.form1.cboPegSoft.options[selectedItem].value;
    var i;
    var isNew = true;
    if (boxLength != 0) {
        for (i = 0; i < boxLength; i++) {
        thisitem = document.form1.listCont.options[i].text;
        if (thisitem == selectedText) {
            isNew = false;
            break;
            }
        }
    }
    if (form1.cboPegSoft.value != "-1"){
        if (isNew) {
            newoption = new Option(selectedText, selectedValue, false, false);
            document.form1.listCont.options[boxLength] = newoption;
            form1.listcont2.value = form1.listcont2.value + selectedText;
            }
        }
     form1.txtPegSoft.value = form1.listcont2.value;
}

function resetList(){
    form1.listCont.innerHTML = "";
    form1.listcont2.value = "";
    form1.txtPegSoft.innerHTML = "";
    form1.cboPegSoft.value = "-1";
}




//rsvp.asp functions
//------------------

function showColl(){
    ShowHide("colleague");
}

function moveAddress(){
    if(document.all.chkDetails.checked == true){
        if(document.all.txtCname.value != ""){
            document.all.txtCname2.value = document.all.txtCname.value;
            }
        if(document.all.txtAdd.value != ""){
            document.all.txtAdd2.value = document.all.txtAdd.value;
            }
        if(document.all.txtAdd.value != ""){
            document.all.txtPcode2.value = document.all.txtPcode.value;
            }
        if(document.all.txtAdd.value != ""){
            document.all.txtTel2.value = document.all.txtTel.value;
            }
        }
    else{
        document.all.txtCname2.value = "";
        document.all.txtAdd2.value = "";
        document.all.txtPcode2.value = "";
        document.all.txtTel2.value = "";
    }
}

function CheckChar(form){
    var chartocheck = form.value.toUpperCase();
    form.value = chartocheck;
}

//global functions
//----------------

function Accept(num){
    var newWindow;
    newWindow == window.showModalDialog("../inc/response.asp?var=" + num,"Notification","status:no;center:yes;help:no;resizable:yes;");
}

function PrintPage(src){
    var newWindow;
    if (window.showModalDialog) {
        newWindow = window.showModalDialog(src,"Notification","dialogHeight:600px;dialogWidth:650px;status:no;center:no;help:no;resizable:yes;");
        }
    else {
        newWindow = window.open(src,"msg","height=600px,width=650px,left=0,top=0,resizable=no,scrollbars=yes,location=no,toolbar=no");
    }
}

function Open(src,name,num1,num2){
    msg=window.open("","msg","height="+ num2 +",width="+ num1 +",left=0,top=0,resizable=no,scrollbars=no,location=no,toolbar=no");
    msg.document.write("<html><title>"+ name +"</title>");
    msg.document.write("<body bgcolor='white' topmargin='2px' leftmargin='2px'>");
    msg.document.write("<img src="+ src +" border='0'>");
    msg.document.write("</body></html>");
}

function emailValidate_onblur(field){
    if (field.value != ""){
        if (CheckData(field.value, "Email") == false){
        alert("The email address may be incorrect.\nPlease enter in the format 'user@company'")
        field.focus();
        }
    }
}

function GeneralNum_onblur(field){
    if (field.value != ""){
        if (CheckData(field.value, "Number") == false){
        alert("Please omit any spaces or other characters in the number")
        field.value = "";
        field.focus();
        }
    }
}

function GeneralText_onblur(field) {
    if (field.value != ""){
        if (CheckData(field.value, "String") == false){
        alert("An invalid character has been entered")
        field.value = "";
        field.focus();
        }
    }
}

function GeneralDate_onblur(field) {
    if (field.value != ""){
        if (CheckData(field.value, "Date") == false){
        alert("An invalid date has been entered\n Please enter the date as dd/mm/yyyy")
        field.value = "";
        field.focus();
        }
    }
}

function Mid(str,start,len){
/**
    IN: str - the string we are LEFTing
        start - our string's starting position (0 based!!)
        len - how many characters from start we want to get

    RETVAL: The substring from start to start+len
**/
    // Make sure start and len are within proper bounds
    if (start < 0 || len < 0) return "";

    var iEnd, iLen = String(str).length;
    if (start + len > iLen){
        iEnd = iLen;
        }
    else{
        iEnd = start + len;
    }
    return String(str).substring(start,iEnd);
}
// ================================================================================================ //
// pgcsformval.js
// ================================================================================================ //
var nbsp = 160;		// non-breaking space char
var node_text = 1;	// DOM text node-type
var emptyString = /^\s*$/ ;
var global_valfield;	// retain valfield for timer thread



// --------------------------------------------
//                  trim
// Trim leading/trailing whitespace off string
// --------------------------------------------

function trim(str)
{
  return str.replace(/^\s+|\s+$/g, '');
}



// --------------------------------------------
//                  setfocus
// Delayed focus setting to get around IE bug
// --------------------------------------------

function setFocusDelayed()
{
  global_valfield.focus();
}

function setfocus(valfield)
{
  // save valfield in global variable so value retained when routine exits
  global_valfield = valfield;
  setTimeout( 'setFocusDelayed()', 100 );
}



// --------------------------------------------
//                  msg
// Display warn/error message in HTML element.
// commonCheck routine must have previously been called
// --------------------------------------------

function msg(fld,     // id of element to display message in
             msgtype, // class to give element ("warn" or "error")
             message) // string to display
{
  // setting an empty string can give problems if later set to a 
  // non-empty string, so ensure a space present. (For Mozilla and Opera one could 
  // simply use a space, but IE demands something more, like a non-breaking space.)
  var dispmessage;
  if (emptyString.test(message)) 
    dispmessage = String.fromCharCode(nbsp);    
  else  
    dispmessage = message;

  var elem = document.getElementById(fld);

  elem.innerHTML = dispmessage;

//  elem.firstChild.nodeValue = dispmessage;  
  
  elem.className = msgtype;   // set the CSS class to adjust appearance of message
}



// --------------------------------------------
//            commonCheck
// Common code for all validation routines to:
// (a) check for older / less-equipped browsers
// (b) check if empty fields are required
// Returns true (validation passed), 
//         false (validation failed) or 
//         proceed (don't know yet)
// --------------------------------------------

var proceed = 2;  

function commonCheck    (valfield,   // element to be validated
                         infofield,  // id of element to receive info/error msg
                         required)   // true if required
{
  if (!document.getElementById) 
    return true;  // not available on this browser - leave validation to the server
  var elem = document.getElementById(infofield);
  if (!elem.firstChild) return true;  // not available on this browser 
//  if (elem.firstChild.nodeType != node_text) return true;  // infofield is wrong type of node  

  if (emptyString.test(valfield.value)) {
    if (required) {
      msg (infofield, "error", "<img src='images/corporatewebsite/templates/global/bg_bullet_red.gif' alt='Error Identifier' title='This field is required' />");  
      setfocus(valfield);
      return false;
    }
    else {
      msg (infofield, "warn", "");   // OK
      return true;  
    }
  }
  return proceed;
}



// -----------------------------------------
//            commonCheck2
// Common code for checkbox/combo box validation routines to
// check for older / less-equipped browsers
// Returns true (validation passed) or
//         proceed (don't know yet)
// -----------------------------------------

function commonCheck2   (vfld,   // element to be validated
                         ifld)   // id of element to receive info/error msg
{
  if (!document.getElementById) 
    return true;  // not available on this browser - leave validation to the server
  var elem = document.getElementById(ifld);
  if (!elem.firstChild)
    return true;  // not available on this browser 
//  if (elem.firstChild.nodeType != node_text)
//    return true;  // ifld is wrong type of node  

  msg (ifld, "warn", "");  // clear any previous error message
  return proceed;
}



// --------------------------------------------
//            validatePresent
// Validate if something has been entered
// Returns true if so 
// --------------------------------------------

function validatePresent(valfield,   // element to be validated
                         infofield ) // id of element to receive info/error msg
{
  var stat = commonCheck (valfield, infofield, true);
  if (stat != proceed) return stat;

  msg (infofield, "warn", "");  
  return true;
}



// -----------------------------------------
//            validateCombo
// Validate if an option other than 'Please Select' has been chosen
// Returns true if so 
// -----------------------------------------

function validateCombo(valfield,   // element to be validated
                         infofield ) // id of element to receive info/error msg
{
  var stat = commonCheck2 (valfield, infofield);
  if (stat != proceed) return stat;

  if (valfield.value!="-1") return true;

  // if we get here then the validation has failed

    msg (infofield, "error", "<img src='images/corporatewebsite/templates/global/bg_bullet_red.gif' alt='Error Identifier' title='Please choose an option' />");
    setfocus(valfield);
    return false;
 }



// --------------------------------------------
//               validateEmail
// Validate if e-mail address
// Returns true if so (and also if could not be executed because of old browser)
// --------------------------------------------

function validateEmail  (valfield,   // element to be validated
                         infofield,  // id of element to receive info/error msg
                         required)   // true if required
{
  var stat = commonCheck (valfield, infofield, required);
  if (stat != proceed) return stat;

  var tfld = trim(valfield.value);  // value of field with whitespace trimmed off
  var email = /^[^@]+@[^@.]+\.[^@]*\w\w$/  ;
  if (!email.test(tfld)) {
    msg (infofield, "error", "<img src='images/corporatewebsite/templates/global/bg_bullet_red.gif' alt='Error Identifier' title='Not a valid e-mail address' />");
    setfocus(valfield);
    return false;
  }

  var email2 = /^[A-Za-z][\w.-]+@\w[\w.-]+\.[\w.-]*[A-Za-z][A-Za-z]$/  ;
  if (!email2.test(tfld)) 
    msg (infofield, "warn", "<img src='images/corporatewebsite/templates/global/bg_bullet_red.gif' alt='Error Identifier' title='Unusual e-mail address - check if correct' />");
  else
    msg (infofield, "warn", "");
  return true;
}



// --------------------------------------------
//            validateTelnr
// Validate telephone number
// Returns true if so (and also if could not be executed because of old browser)
// Permits spaces, hyphens, brackets and leading +
// --------------------------------------------

function validateTelnr  (valfield,   // element to be validated
                         infofield,  // id of element to receive info/error msg
                         required)   // true if required
{
  var stat = commonCheck (valfield, infofield, required);
  if (stat != proceed) return stat;

  var tfld = trim(valfield.value);  // value of field with whitespace trimmed off
  var telnr = /^\+?[0-9 ()-]+[0-9]$/  ;
  if (!telnr.test(tfld)) {
    msg (infofield, "error", "<img src='images/corporatewebsite/templates/global/bg_bullet_red.gif' alt='Error Identifier' title='Not a valid telephone number. Characters permitted are digits, space ()- and leading +' />");
    setfocus(valfield);
    return false;
  }

  var numdigits = 0;
  for (var j=0; j<tfld.length; j++)
    if (tfld.charAt(j)>='0' && tfld.charAt(j)<='9') numdigits++;

  if (numdigits<6) {
    msg (infofield, "error", "<img src='images/corporatewebsite/templates/global/bg_bullet_red.gif' alt='Error Identifier' title='" + numdigits + " digits - too short' />");
    setfocus(valfield);
    return false;
  }

  if (numdigits>14)
    msg (infofield, "warn", "<img src='images/corporatewebsite/templates/global/bg_bullet_red.gif' alt='Error Identifier' title='" + numdigits + " digits - check if correct' />");
  else { 
    if (numdigits<10)
      msg (infofield, "warn", "<img src='images/corporatewebsite/templates/global/bg_bullet_red.gif' alt='Error Identifier' title='Only " + numdigits + " digits - check if correct' />");
    else
      msg (infofield, "warn", "");
  }
  return true;
}



// --------------------------------------------
//             validateAge
// Validate person's age
// Returns true if OK 
// --------------------------------------------

function validateAge    (valfield,   // element to be validated
                         infofield,  // id of element to receive info/error msg
                         required)   // true if required
{
  var stat = commonCheck (valfield, infofield, required);
  if (stat != proceed) return stat;

  var tfld = trim(valfield.value);
  var ageRE = /^[0-9]{1,3}$/
  if (!ageRE.test(tfld)) {
    msg (infofield, "error", "ERROR: not a valid age");
    setfocus(valfield);
    return false;
  }

  if (tfld>=200) {
    msg (infofield, "error", "ERROR: not a valid age");
    setfocus(valfield);
    return false;
  }

  if (tfld>110) msg (infofield, "warn", "Older than 110: check correct");
  else {
    if (tfld<7) msg (infofield, "warn", "Bit young for this, aren't you?");
    else        msg (infofield, "warn", "");
  }
  return true;
}



// -----------------------------------------
//            validateCheckbox
// Validate that the correct number of checkboxes has been checked.
// Returns true if valid (and also if could not be executed because 
// of old browser)
// -----------------------------------------

function validateCheckbox  (vfld,   // checkboxes to be validated
                            ifld,   // id of element to receive info/error msg
                            nr,     // number of checkboxes to be checked. >=2
                            cond)   // condition: -1 = less than or equal to nr
                                    //             0 = equal to nr (default)
                                    //             1 = greater than or equal to nr
{
  if (!nr || nr<2) {
    alert('Programming error in validateCheckbox: nr<2'); 
       // for nr=1 use radio buttons or validateConfirm
    return true;
  }
  if (!cond) cond = 0;

  var stat = commonCheck2(vfld, ifld);
  if (stat != proceed) return stat;

  // count how many boxes have been checked by the reader
  var count = 0;
  for (var j=0; j<vfld.length; j++)
     if (vfld[j].checked) count++;

  if (count==nr) return true;
  if (count<nr && cond==-1) return true;
  if (count>nr && cond==1)  return true;

  // if we get here then the validation has failed

  var suffix='';
  if (count>1) suffix='es';

  var errorMsg;

  if (count<nr) errorMsg = 'Only ' + count + ' box' + suffix + ' checked: ' + nr + ' required';
  if (count>nr) errorMsg = '' + count + ' boxes checked: maximum ' + nr + ' allowed';
  if (count==0) errorMsg = 'No boxes checked: ' + nr + ' required';

  msg (ifld, "error", errorMsg);
  return false;
}


// -----------------------------------------
//            validateConfirm 
// Usually one doesn't want to validate if 1 checkbox of a set has been
// checked, because in this case one would use radio buttons instead.
// But sometimes one wants a reader to check a single box to confirm that 
// he or she agrees to something. That is covered by this routine.
//
// Returns true if valid (and also if could not be executed because 
// of old browser)
// -----------------------------------------

function validateConfirm   (vfld,   // checkbox to be validated
                            ifld)   // id of element to receive info/error msg
{
  var stat = commonCheck2(vfld, ifld);
  if (stat != proceed) return stat;

  if (vfld.checked) return true;

  // if we get here then the validation has failed

  var errorMsg = 'Please read the above message and confirm you agree to it';

  msg (ifld, "error", errorMsg);
  return false;
}

// ================================================================================================ //
// pgcsflashcheck.js
// ================================================================================================ //
// moock fpi [f.lash p.layer i.nspector]
// version: 1.3.7
// written by colin moock
// code maintained at: http://www.moock.org/webdesign/flash/detection/moockfpi/
// terms of use posted at: http://www.moock.org/terms/



// =============================================================================
// These are the user defined globals.
// Modify the following variables to customize the inspection behaviour.

var requiredVersion = 7;   // Version the user needs to view site (max 9, min 2)
var useRedirect = false;    // Flag indicating whether or not to load a separate
                           // page based on detection results. Set to true to
                           // load a separate page. Set to false to embed the
                           // movie or alternate html directly into this page.
                           
// Only set next three vars if useRedirect is true...
var flashPage   = "movie.html"    // The location of the flash movie page
var noFlashPage = "noflash.html"  // Page displayed if the user doesn't have the
                                  // plugin or we can't detect it.
var upgradePage = "upgrade.html"  // Page displayed if we detect an old plugin
// =============================================================================



// *************
// Everything below this point is internal until after the BODY tag.
// Do not modify! Proceed to the BODY tag for further instructions.
// *************

// System globals
var flash2Installed = false;    // boolean. true if flash 2 is installed
var flash3Installed = false;    // boolean. true if flash 3 is installed
var flash4Installed = false;    // boolean. true if flash 4 is installed
var flash5Installed = false;    // boolean. true if flash 5 is installed
var flash6Installed = false;    // boolean. true if flash 6 is installed
var flash7Installed = false;    // boolean. true if flash 7 is installed
var flash8Installed = false;    // boolean. true if flash 8 is installed
var flash9Installed = false;    // boolean. true if flash 9 is installed
var maxVersion = 9;             // highest version we can actually detect
var actualVersion = 0;          // version the user really has
var hasRightVersion = false;    // boolean. true if it's safe to embed the flash movie in the page
var jsVersion = 1.0;            // the version of javascript supported

// Check the browser...we're looking for ie/win
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows


// This is a js1.1 code block, so make note that js1.1 is supported.
jsVersion = 1.1;

// Write vbscript detection on ie win. IE on Windows doesn't support regular
// JavaScript plugins array detection.
if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}

// Next comes the standard javascript detection that uses the 
// navigator.plugins array. We pack the detector into a function so that 
// it preloads before being run.

function detectFlash() {  
  // If navigator.plugins exists...
  if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {

      // Some version of Flash was found. Time to figure out which.
      
      // Set convenient references to flash 2 and the plugin description.
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

      // DEBUGGING: uncomment next line to see the actual description.
      // alert("Flash plugin description: " + flashDescription);
      
      // A flash plugin-description looks like this: Shockwave Flash 4.0 r5
      // We can get the major version by grabbing the character before the period
      // note that we don't bother with minor version detection. 
      // Do that in your movie with $version or getVersion().
      var flashVersion = parseInt(flashDescription.substring(16));

      // We found the version, now set appropriate version flags. Make sure
      // to use >= on the highest version so we don't prevent future version
      // users from entering the site.
      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }
  
  // Loop through all versions we're checking, and
  // set actualVersion to highest detected version.
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  
  // If we're on msntv (formerly webtv), the version supported is 4 (as of
  // January 1, 2004). Note that we don't bother sniffing varieties
  // of msntv. You could if you were sadistic...
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;  
  
  // DEBUGGING: uncomment next line to display flash version
  // alert("version detected: " + actualVersion);


  // We're finished getting the version on all browsers that support detection.
  // Time to take the appropriate action.

  // If the user has a new enough version...
  if (actualVersion >= requiredVersion) {
    // ...then we'll redirect them to the flash page, unless we've
    // been told not to redirect.
    if (useRedirect) {
      // Need javascript1.1 to do location.replace
      if(jsVersion > 1.0) {
        // It's safe to use replace(). Good...we won't break the back button.
        window.location.replace(flashPage);  
      } else {
        // JavaScript version is too old, so use .location to load
        // the flash page.
        window.location = flashPage;
      }
    }

    // If we got here, we didn't redirect. So we make a note that we should
    // write out the object/embed tags later.
    hasRightVersion = true;                
  } else {  
    // The user doesn't have a new enough version.
    // If the redirection option is on, load the appropriate alternate page.
    if (useRedirect) {
      // Do the same .replace() call only if js1.1+ is available.
      if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
}

detectFlash();  // call our detector now that it's safely loaded. 
// ================================================================================================ //
// pgcscornerfy.js
// ================================================================================================ //
// --------------------------------------------------
var oldInternetExplorer = false;

function bp_roundEm(){

if(window.location!="http://www.pegasus.co.uk/"){
	if(window.location!="http://www.pegasussoftware.ie/"){

        var block = getDescendentsByTagName(document.getElementById('content'),'div');

        for(x=0;x<block.length;x++){
                if(block[x].className.indexOf('cornerfy')!=-1){
                        
                        var c_html = "";
                        var block_top = block[x].offsetHeight - 5;
                        
                        if(oldInternetExplorer){
                                c_html += "<div class=\"blc\" style=\"top: " + block_top + "px; background: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/corporatewebsite/templates/corners/bg_pic_blc.png', sizingMethod='scale');\">&nbsp;</div>";
                                c_html += "<div class=\"brc\" style=\"top: " + block_top + "px; background: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/corporatewebsite/templates/corners/bg_pic_brc.png', sizingMethod='scale');\">&nbsp;</div>";
                
                                c_html += "<div class=\"tlc\" style=\"background: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/corporatewebsite/templates/corners/bg_pic_tlc.png', sizingMethod='scale');\">&nbsp;</div>";
                                c_html += "<div class=\"trc\" style=\"background: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/corporatewebsite/templates/corners/bg_pic_trc.png', sizingMethod='scale');\">&nbsp;</div>";

                        } else {
                                c_html += "<div class=\"tlc\">&nbsp;</div>";
                                c_html += "<div class=\"trc\">&nbsp;</div>";
                                c_html += "<div class=\"blc\" style=\"top: " + block_top + "px;\">&nbsp;</div>";
                                c_html += "<div class=\"brc\" style=\"top: " + block_top + "px;\">&nbsp;</div>";

                        }
                        
                        var o = c_html + block[x].innerHTML;
                        block[x].innerHTML = o;
                }
        }

        return;
	
	}
}
}
	
