﻿$(document).ready(function(){
  var newFreebie01 = new Image();
  var newFreebie02 = new Image();
  newFreebie01.src = 'http://www.pulsestar.co.uk/images/freedownload02.jpg';
  newFreebie02.src = 'http://www.pulsestar.co.uk/images/freetrial02.jpg';

  $('#btnFreebie01').mouseover(function() {
    $(this).attr('src', newFreebie01.src);
  });

  $('#btnFreebie01').mouseout(function() {
    $(this).attr('src', 'http://www.pulsestar.co.uk/images/freedownload01.jpg');
  });

  $('#btnFreebie02').mouseover(function() {
    $(this).attr('src', newFreebie02.src);
  });

  $('#btnFreebie02').mouseout(function() {
    $(this).attr('src', 'http://www.pulsestar.co.uk/images/freedtrial01.jpg');
  });

  $('table.t01 tr:even').addClass('even');

  $('table.t01 tr').mouseover(function() {
    $(this).addClass('highlight');
  });

  $('table.t01 tr').mouseout(function() {
    $(this).removeClass('highlight');
  });
});
/*
 * Helper CSS Express Drop-Down Menu IE6 and lower only  which does not support :hover on <li>
 * The PulseStar website does not support IE6. Think that's out of date now for a company
 * targeted website. But left in for present case need is thrust.
 */
function ExpressMenu(){ //v1.1.0.2 by PVII-www.projectseven.com
 /*@cc_on @if (@_jscript_version <= 5.6)
 var i,k,g,lg,r=/\s*hvr/,nn='',c,cs='hvr',bv='menubar';
 for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
 lg=g.getElementsByTagName("LI");if(lg){for(k=0;k<lg.length;k++){
 lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
 this.className=cl;};lg[k].onmouseout=function(){c=this.className;
 this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
 /*@end @*/
}
/*
 * Open a new window and set focus on it
 */
var winContent;
function newWindow(newContent, newWin){
   winContent = window.open(newContent, newWin);
   winContent.focus();
   return false;
  }
/*
 * Error handling. Each form has a hidden input field defined as follows:
 * <input type="hidden" id="iderrtbl" value="">
 * This removes a specific error message on page (errNode) within parentTag
 * See above for more information
 */
function rmv_err_element(parentTag, errNode){
    var objErrNode = document.getElementById(errNode);

    if (objErrNode){
       document.getElementById(parentTag).removeChild(objErrNode);
       // Recover hidden error id's table from form
       var strErrorTable = document.getElementById("iderrtbl").value;
       // Create array for id's
       var arrayErrors = new Array();
       if (strErrorTable)
           arrayErrors = strErrorTable.split(' ');

       if (arrayErrors.length){
           var i1 = 0;
           var i2 = 0;
           // zap page error table
           document.getElementById("iderrtbl").value = '';
           // If current error array element is NOT same as error removed from div copy back to page error table
           for (i1 = 0; i1 < arrayErrors.length; i1++){
                if (arrayErrors[i1] != errNode){
                    if (i2)
                        document.getElementById("iderrtbl").value += ' ';

                    document.getElementById("iderrtbl").value += arrayErrors[i1];
                    i2++;
                   }
           }
       }
    }
}
/*
 * HTML form error handling. Each form has a hidden input field usually defined as follows:
 * <input type="hidden" id="iderrtbl" value="">
 * Each input element of a form can have a valisation routine.
 * This is called with the id of the parent div for the form
 * If an error is found an error text node is created and its id placed in iderrtbl above
 * All id's in iderrtbl are separatted by a space.
 * This routine cleans out iderrtbl and removes all error text nodes from the HTML document
 *
 */
function rmv_err_elements(parentTag){
    // Recover hidden error id's table from form
    var strErrorTable = document.getElementById("iderrtbl").value;
    var arrayErrors = new Array();
    if (strErrorTable)
        arrayErrors = strErrorTable.split(' ');
    if (arrayErrors.length){
        var i1 = 0;
        var objRemoveNode;
        for (i1 = arrayErrors.length; i1 > 0; i1--){
             // alert("Error " + arrayErrors[i1-1]);
             objRemoveNode = document.getElementById(arrayErrors[i1-1]);
             document.getElementById(parentTag).removeChild(objRemoveNode);
        }
     document.getElementById("iderrtbl").value = '';
    }
}
/* General tiddlers */
function f1() {
  history.go(0);
  parent.location='#top';
}
function f2() {
  parent.location='index.php';
}
function f3() {
  parent.location='#top';
}
