﻿// Loads up the various functions we are going to use
$(document).ready(function(){
    addSpan();     
});

// Adds a span around the first word of an H2 with a class of .large_first_word
function addSpan() {
    //Target H2's
      var target = $('h2.large_first_word')[0];
      if (!target) { return false };
      //Get the text content of the H2
    var text = target.firstChild.nodeValue;
    if (!text) { return false };
    //Get the first letter
    var first_letter = text.substr(0,1);
    if ( text ) {
    //chop the first letter off the H2 content
    target.firstChild.nodeValue = text.slice(1);
  };
  $("<span class='large_header'>" + first_letter +"</span>").prependTo( target );
};

/**********************************************************/ 
/* Function: LaunchWindow      
/* Purpose: Opens pop-up forms to a standardised width, 
/*          height and position within parent window
/* Used by Test English form
/**********************************************************/             
function LaunchWindow(strURL, strName, intWidth, intHeight)
{
    var sw = screen.availWidth;
    var sh = screen.availHeight;
    var left = (sw-intWidth)/2;
    var top = (sh-intHeight)/2;
    var strURL = strURL;
   
    windowHandle = window.open(strURL, strName,"width=" + intWidth + ", height="+intHeight+", location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes, left="+left+", top="+top+"")
    windowHandle.focus();
}