﻿// JScript File
var div2print;

// Redirect a page
function getURL(strURL)
{
    try
    {
        window.location = strURL;
    }
    catch (e) {}
}

// Returns Numeric
function getNumeric(strString, allowChars)
{   
    var intRetValue = '';
    
    try
    {
        //debugger;
        var intCount = 0;
        var currentChar = '';
        
        for (intCount = 0; intCount < strString.length; intCount++)
        {
            currentChar = strString.charAt(intCount);
            if (allowChars.indexOf(currentChar) != -1)
            {
                intRetValue += currentChar;
            }
        }
    }
    catch (e) {}
    
    return intRetValue;
}

function taCount(visCnta) 
{ 
    debugger;
    var visCnt = document.getElementById(visCnta);
	var taObj=event.srcElement;
	if (taObj.value.length>taObj.maxLength*1) taObj.value=taObj.value.substring(0,taObj.maxLength*1);
	if (visCnt) visCnt.innerText=taObj.maxLength-taObj.value.length;
}

function characters_remaining(txtBox, divId, maxCount) 
{ 
    var txt = document.getElementById(txtBox);
    var txtvalue = '';
    var txtLength = 0;
    var txtRemaining = 0;
    var divbox = document.getElementById(divId);
    if (txt)
    {
        txtvalue = txt.value;
        txtLength = txtvalue.length;
        txtRemaining = maxCount - txtLength;
    }
    if (divbox)
    {
        divbox.innerText = txtRemaining;
    }
    return true;
}


function countChars(txtBox, divId, maxCount) 
{ 
    //debugger;
    var txt = document.getElementById(txtBox);
    var txtvalue = '';
    var txtLength = 0;
    var txtRemaining = 0;
    var divbox = document.getElementById(divId);
    if (txt)
    {
        txtvalue = txt.value;
        txtLength = txtvalue.length;
        txtRemaining = maxCount - txtLength;
    }
    if (divbox)
    {
        divbox.innerHTML = 'Position: ' + getposition(txtBox) + ' - ' + txtRemaining + ' characters remaining';
    }
    //return true;
    //debugger;
    //
    // NEW - workaround for multiline textbox. DONT set the maxlength propery in asp textbox ensure use a semicolon on call
    //
    //The following is ignored by onkeyup but used by onkeypress in that if false gets returned the character is ignored.
    //
    // Example call (use both lines for mulitline)
    //
    //Me.txtAdBody.Attributes.Add("onkeyup", "return countChars('" & Me.txtAdBody.ClientID & "', 'sAdBody', 125);")
    //Me.txtAdBody.Attributes.Add("onkeypress", "return countChars('" & Me.txtAdBody.ClientID & "', 'sAdBody', 125);")
    var b = txt.value.length <= (maxCount - 1);
    return b;
    
}

function getposition(txtbox) {
    //debugger;
    var obj = document.getElementById(txtbox);
    
var CurPos = 0;
var len = 0;

if (document.selection) {
    var currentRange = document.selection.createRange();
    var workRange = currentRange.duplicate();
    obj.select();
    var allRange = document.selection.createRange();
    
    while (workRange.compareEndPoints("StartToStart", allRange) > 0) {
        workRange.moveStart("character", -1);
        len++;
    }
    currentRange.select();
    return len;
}
else {
    len = obj.selectionStart;
}


return len;
}

// Check for valid email address
function validEmail(email)
{
	var filter  = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	if (filter.test(email))
	{
	    return true;
	}
	else
	{
	    return false;
	}
}

// Print function for admin pages
function adminPrintMe(id)
{
    //debugger;
    var links = document.getElementById(id);
    if ((links != null) && (links != 'undefined'))
    {
        links.style.display = 'none';
    }
    window.print();
    if ((links != null) && (links != 'undefined'))
    {
        links.style.display = 'block';
    }
}

function PrintDiv(strText, relativePath){
	var a = window.open('','','width=300,height=300');
	a.document.open("text/html");
	a.document.write(strText);
	a.print();
    a.document.write('<a onclick="window.close();" style="background-image:url(' + relativePath + '_images/closeprint.jpg); display: block; width: 50px; cursor: pointer; float: right;">&nbsp;</a>');
	a.document.close();
}

function HtmlEncode(RawHTML) {
var encodedHtml;
     encodedHtml = escape(RawHTML);
     encodedHtml = encodedHtml.replace(/\//g,"%2F");
     encodedHtml = encodedHtml.replace(/\?/g,"%3F");
     encodedHtml = encodedHtml.replace(/=/g,"%3D");
     encodedHtml = encodedHtml.replace(/&/g,"%26");
     encodedHtml = encodedHtml.replace(/@/g,"%40");
     
     return encodedHtml;
   } 
   
function openPopup(url,width,height) 
{
   //var width = 700;
    //var height = 900;
   //debugger;
   var LEFT = parseInt((screen.availWidth/2) - (width/2));
   var TOP = parseInt((screen.availHeight/2) - (height/2));
   var windowFeatures = "width=" + width + ",height=" + height + ",toolbar=yes,status=no,location=no,resizable=yes,directories=no,scrollbars=yes,left=" + LEFT + ",top=" + TOP + "screenX=" + LEFT + ",screenY=" + TOP;
   myWindow = window.open(url, "Help", windowFeatures);
   event.returnValue = false;
   return false;
}




//Use as is or customise for popup messageboxes on the client that only perform POSTBACK
//if the user responds YES
//
//Example - heres a delete example where user hits the delete button and they have to
//          confirm before the POSTBACK occurs for the delete to execute
//
// Add a button to page - which requires a messagebox for confirmation of the function...
//
//      <asp:Button runat="server" width="140px" Visible="true" ID="btnDelete" ToolTip="Delete exception messages" Text="Exeptions" />
//
// Wire up the buttons OnClick() handler to the javascript confirm dialog
//
//      Me.btnDelete.Attributes.Add("onclick", "javascript:return confirmDelete('Are you sure you want to delete the exception messages?');")
//
// Finally some code 
//        Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
//            Try
//                DeleteMessages()
//            Catch ex As Exception
//                // Catch error
//            End Try
//        End Sub
//
function confirmDialog(msg)
{
    exit = confirm( msg + " (OK=Yes Cancel=NO)")
 
    if (exit == true)
    {
        return true; //add order
    }
    else
    {
        return false; //dont add order
    }
}

function confirmDialogEx2(msg,savecontrol) {
    exit = confirm(msg + " (OK=Yes Cancel=NO)")
    //debugger;
    if (exit == true) {
        $('.' + savecontrol).attr("value", "true");
        return true; //add order
       
    }
    else {
        $('.' + savecontrol).attr("value", "false");
        return true; //dont add order
        
    }
}

function confirmDialogEx(msg1,msg2) {
    exit = confirm(msg1 + " (OK=Yes Cancel=NO)")

    if (exit == true) {
        // ask second question
        exit = confirm(msg2 + " (OK=Yes Cancel=NO)")
        if (exit == true)
        {
            return true; //add order
        }
        else
        {
            return false; //add order
        }
        
    }
    else {
        return false; //dont add order
    }
}



var bSaving = false;
var bTested = false;
var bSavePrompt = true;

function checksaved(xForm, btnID) {
    //debugger;
    
    if (!bSaving) {

        try {
            var aa = IsFormDirty(xForm);
            if (aa) {

                var x = confirm('Save before navigating away?');
                if (x == true) {
                    bTested = false;
                    __doPostBack(btnID, '');
                }
            }
        }
        catch (e) {
            //alert(e);
        }
        
    }
    else {
        //alert("bSaving is: " + bSaving);
    }
}



//$(document).ready
//(
//    function() {
//        //debugger;

//        try {
//            $('.widgetcontent').corner("round bl br");
//        }
//        catch (e) { }
//    }
//);

function checksaved2(xForm, btnID) {
    //debugger;
    if (!bSaving) 
    {
        if (!bTested)
        {
            if (IsFormDirty(xForm)) {

                if (confirm('Save changes?')) {
                    return true;
                }
                else {
                    return false;
                }
            }
        }
    }
}

function checksaved3() {

    //debugger;
    if (!bSaving) {
        if (IsFormDirty(xForm)) {
            if (confirm('Save changes?')) {
                __doPostBack(btnID, '');
            }
        }
    }
}

function checkIfUserWantsSave(msg,btnID) {
    //debugger;
    if (bSavePrompt) {
        exit = confirm(msg + " (OK=Yes Cancel=NO)")
        //debugger;
        if (exit == true) {
            //__doPostBack(btnID, 'save');
            document.getElementById(btnID).click();
            //$('#' + btnID).trigger('click');
            return false;
        }
    }   
}

function IsFormDirty(xForm) {
    /* Returns an indication of whether all fields are in their default state */
    /* True means it has changed */

    var eForm = document.getElementById(xForm);

    var iNumElems = eForm.elements.length;

    try {
        for (var i = 0; i < iNumElems; i++) {
            var eElem = eForm.elements[i];
            if ("text" == eElem.type || "TEXTAREA" == eElem.tagName) {
                if (eElem.value != eElem.defaultValue) {

                    if (eElem.parentElement.className.indexOf('Rad') == -1 && (eElem.className.indexOf('Rad') == -1)) {
                        return true;
                    }
                }
            }
            else if ("checkbox" == eElem.type || "radio" == eElem.type) {
                if (eElem.checked != eElem.defaultChecked) {
                    return true;
                }
            }
            else if ("SELECT" == eElem.tagName) {
                var cOpts = eElem.options;
                var iNumOpts = cOpts.length;
                for (var j = 0; j < iNumOpts; j++) {
                    var eOpt = cOpts[j];

                    if (eOpt.selected != eOpt.defaultSelected) {
                        // dont want to validate the drop downs on the html editor
                        //debugger;
                        //eOpt.parentElement.className
                        //if (eOpt.parentElement.id.indexOf('mce_editor_') == -1 && (eOpt.parentElement.id.indexOf('_toolbar') == -1 || eOpt.parentElement.id.indexOf('_styleSelect'))) {
                        if (eOpt.parentElement.className.indexOf('Rad') == -1 && (eOpt.parentElement.id.indexOf('_toolbar') == -1)) {
                            return (true);
                        }
                    }
                }
            }
        }    
    }
    catch (e) {
        return (true);
    }
    
    return false;
}


function trim(str) {
    var trimmed = str.replace(/^\s+|\s+$/g, '');
    return trimmed;
}


//Clear control x if control y is empty
function clearControlXifControlYEmpty(ctrlX, CtrlY) {
    //debugger;
    var currentvalue = $('.' + CtrlY).attr("value");
    if (currentvalue == '') {
        $('.' + ctrlX).attr("value", "");
    }

}


function IsNumeric(strString)
//  check for valid numeric strings	
{
    var strValidChars = "0123456789.";
    var strChar;
    var blnResult = true;

    if (strString.length == 0) return false;

    //  test strString consists of valid characters listed above
    for (i = 0; i < strString.length && blnResult == true; i++) {
        strChar = strString.charAt(i);
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false;
        }
    }
    return blnResult;
}

function IsInteger(strString)
//  check for valid numeric strings	
{
    var strValidChars = "0123456789";
    var strChar;
    var blnResult = true;

    if (strString.length == 0) return false;

    //  test strString consists of valid characters listed above
    for (i = 0; i < strString.length && blnResult == true; i++) {
        strChar = strString.charAt(i);
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false;
        }
    }
    return blnResult;
}

function RadioButtonSelected(sender, args) {


    //2nd: ensure one of the radios is selected
    $('.rdoUserType').each(function() {
        //if its blank set warning in the warning span immediately after the textbox
        //debugger;
        if ($('.rdoUser')[0].firstChild.checked == false) {
            if ($('.rdoGolfPro')[0].firstChild.checked == false) {
                //debugger;
                args.IsValid = false;
                return;

            }
            else {
                args.IsValid = true;
            }
        }
        if (blnError == true) {
            $('.lblUserType').text("Required");
        }
        else {
            $('.lblUserType').text("");
        }
    })

}

function URLEncode(clearString) {
    var output = '';
    var x = 0;
    clearString = clearString.toString();
    var regex = /(^[a-zA-Z0-9_.]*)/;
    while (x < clearString.length) {
        var match = regex.exec(clearString.substr(x));
        if (match != null && match.length > 1 && match[1] != '') {
            output += match[1];
            x += match[1].length;
        } else {
            if (clearString[x] == ' ')
                output += '+';
            else {
                var charCode = clearString.charCodeAt(x);
                var hexVal = charCode.toString(16);
                output += '%' + (hexVal.length < 2 ? '0' : '') + hexVal.toUpperCase();
            }
            x++;
        }
    }
    return output;
}

function URLDecode(encodedString) {
    var output = encodedString;
    var binVal, thisString;
    var myregexp = /(%[^%]{2})/;
    while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
        binVal = parseInt(match[1].substr(1), 16);
        thisString = String.fromCharCode(binVal);
        output = output.replace(match[1], thisString);
    }
    return output;
}


//Is used simply by including server side as follows, passing the id of the div to print. (what you get is a link saying 'print this' which pops up a dialog containing the
//content and the print dialog
//
//              Example include...(see golfpro job
//              Me.cMain.InnerHtml += Common.includePrint("divExtraContent") 
//
function CallPrint(strid,strTitle) 
{
    //debugger;
    var prtContent = document.getElementById(strid);
    var WinPrint =
    window.open('', '', 'left=0,top=0,width=400,resize=1,height=300,toolbar=0,scrollbars=0,status=0');
    WinPrint.document.write('<h1>' + strTitle + '</h1>');
    //WinPrint.document.write(prtContent.innerHTML);
    //debugger;
    WinPrint.document.write(removeHTMLTags(strid));
    WinPrint.document.close();
    WinPrint.focus();
    WinPrint.print();
    WinPrint.close();
    //prtContent.innerHTML=strOldOne;
}

//Is used simply by including server side as follows, passing the id of the div to print. (what you get is a link saying 'print this' which pops up a dialog containing the
//content and the print dialog
//
//              Example include...(see golfpro job
//              Me.cMain.InnerHtml += Common.includePrint("divExtraContent") 
//
function CallPrintEx(strid) {
    //debugger;
    var strInputCode;
    var prtContent = document.getElementById(strid);
    var WinPrint =
    window.open('', '', 'left=0,menubar=yes,resizable=yes,top=0,width=400,height=300,toolbar=1,scrollbars=1  ,status=0');
    WinPrint.document.write("<html>");
    WinPrint.document.write("<head>");
    WinPrint.document.write("<LINK REL=StyleSheet HREF='" + siteroot + "_style/core.css' TYPE='text/css'>");
    WinPrint.document.write("<LINK REL=StyleSheet HREF='" + siteroot + "_style/pglayouts.css' TYPE='text/css'>");
    WinPrint.document.write("</head>");
    WinPrint.document.write("<body>");
    //WinPrint.document.write(prtContent.innerHTML);
    //debugger;

    if (document.getElementById && document.getElementById(strid)) {
        strInputCode = document.getElementById(strid).innerHTML;
    }
    WinPrint.document.write(strInputCode);
    WinPrint.document.write("</body>");
    WinPrint.document.write("</html>");
    WinPrint.document.close();
    WinPrint.focus();
    //WinPrint.print();
    //WinPrint.close();
    //prtContent.innerHTML=strOldOne;
}


//Just prints the content
function CallPrintDirect(strContent) {
    //debugger;
    var strInputCode;
    var prtContent = strContent;
    var WinPrint =
    window.open('', '', 'left=0,menubar=yes,resizable=yes,top=0,width=400,height=300,toolbar=1,scrollbars=1  ,status=0');
    WinPrint.document.write("<html>");
    WinPrint.document.write("<head>");
    WinPrint.document.write("<LINK REL=StyleSheet HREF='" + siteroot + "_style/core.css' TYPE='text/css'>");
    WinPrint.document.write("<LINK REL=StyleSheet HREF='" + siteroot + "_style/pglayouts.css' TYPE='text/css'>");
    WinPrint.document.write("</head>");
    WinPrint.document.write("<body>");

    WinPrint.document.write(strContent);
    
    WinPrint.document.write("</body>");
    WinPrint.document.write("</html>");
    WinPrint.document.close();
    WinPrint.focus();
    //WinPrint.print();
    //WinPrint.close();
    //prtContent.innerHTML=strOldOne;
}

//Is used simply by including server side as follows, passing the id of the div to print. (what you get is a link saying 'print this' which pops up a dialog containing the
//content and the print dialog
//
//              Example include...(see golfpro job
//              Me.cMain.InnerHtml += Common.includePrint("divExtraContent") 
//
function CallPrintExJQ(strid) {
    //debugger;
    var strInputCode;
    //var prtContent = document.getElementById(strid);
    var prtContent = $('.' + strid);
    var WinPrint =
    window.open('', '', 'left=0,menubar=yes,resizable=yes,top=0,width=400,height=300,toolbar=1,scrollbars=1  ,status=0');
    WinPrint.document.write("<html>");
    WinPrint.document.write("<head>");
    WinPrint.document.write("<LINK REL=StyleSheet HREF='" + siteroot + "_style/core.css' TYPE='text/css'>");
    WinPrint.document.write("<LINK REL=StyleSheet HREF='" + siteroot + "_style/pglayouts.css' TYPE='text/css'>");
    WinPrint.document.write("</head>");
    WinPrint.document.write("<body>");
    //WinPrint.document.write(prtContent.innerHTML);
    //debugger;

    if (prtContent) {
        strInputCode = $('.' + strid).attr("innerHTML");
    }
    WinPrint.document.write(strInputCode);
    WinPrint.document.write("</body>");
    WinPrint.document.write("</html>");
    WinPrint.document.close();
    WinPrint.focus();
    //WinPrint.print();
    //WinPrint.close();
    //prtContent.innerHTML=strOldOne;
}

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Robert Nyman | http://robertnyman.com/ */
function removeHTMLTags(divID) {
    if (document.getElementById && document.getElementById(divID)) {
        var strInputCode = document.getElementById(divID).innerHTML;
        /* 
        This line is optional, it replaces escaped brackets with real ones, 
        i.e. < is replaced with < and > is replaced with >
        */
        strInputCode = strInputCode.replace(/&(lt|gt);/g, function(strMatch, p1) {
            return (p1 == "lt") ? "<" : ">";
        });
        var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
        //alert("Output text:\n" + strTagStrippedText);
        // Use the alert below if you want to show the input and the output text
        //		alert("Input code:\n" + strInputCode + "\n\nOutput text:\n" + strTagStrippedText);
        //debugger;
        return strTagStrippedText;
    }
}







// Handlers for the show and hide loading page animated gif - a template should have the following in the body tag to use this feature
//  <body onload="hideloadingpage()">

function hideloadingpage() {
    return;
    //debugger;
    if (document.getElementById) { // DOM3 = IE5, NS6 
        document.getElementById('hidepage').style.visibility = 'hidden';
    }
    else {
        if (document.layers) { // Netscape 4 
            document.hidepage.visibility = 'hidden';
        }
        else { // IE 4 
            document.all.hidepage.style.visibility = 'hidden';
        }
    }
    //setInterval("displaytime()", 1000)
}
function showloadingpage() {
    return;
    //debugger;
    if (document.getElementById) { // DOM3 = IE5, NS6 
        document.getElementById('hidepage').style.visibility = 'visible';
    }
    else {
        if (document.layers) { // Netscape 4 
            document.hidepage.visibility = 'show';
        }
        else { // IE 4 
            document.all.hidepage.style.visibility = 'visible';
        }
    }
}




//$(document).ready
//(
//    function() {
//        //debugger;

//        try {
//            $('.widgetcontent').corner("round bl br");
//        }
//        catch (e) { }
//    }
//);


function setimage(imgsrc,obj,subtext) {

    //debugger;
    img = $('.' + obj);
    img[0].src = imgsrc;
    if (subtext == '') {
        //do nothing
    }
    else {
        $('.mainimagesubtext')[0].innerText = subtext;
    }

}


//Made publicly avaiable for user custom forms to call eg var formmessage = encodeMyHtml($('.txtFormMessage').attr("value"));
function encodeMyHtml(str) {
     var encodedHtml = escape(str);
     encodedHtml = encodedHtml.replace(/\//g,"%2F");
     encodedHtml = encodedHtml.replace(/\?/g,"%3F");
     encodedHtml = encodedHtml.replace(/=/g,"%3D");
     encodedHtml = encodedHtml.replace(/&/g,"%26");
     encodedHtml = encodedHtml.replace(/@/g,"%40");
     return encodedHtml;
   }


   // default javascript setup code for the vertical menus - see http://qrayg.com/experiment/cssmenus/
   $(document).ready(function() {
       //debugger;
       $("#navmenu-h li,#navmenu-v li").hover(
    function() { $(this).addClass("iehover"); },
    function() { $(this).removeClass("iehover"); }
  );

       
   });

   function setParentContainer(el, newParent) {
       var newp = document.getElementById(newParent);
       newp.appendChild(el);
   }


   // Support function - use this in your additional javascript section 8 to
   // show the header image as handled by the theme.
   ///



   // Parameters:
   //
   // strChildId: (dtring)
   //
   //               Identifies the Id of the element to be moved to ctl00_divImage. This can be a simple img tag or a complex
   //               set of html elements (div etc). Typically you will define these elements in section 7 but it could be anywhere.
   //
   // intChildHeightToUseWhenEmptyAndComplex (integer)
   //
   //               If using a complex block of html then YOU will need to pass in the required height.
   //
   //               If you just want to display an image then strChildId (parameter 1) is required to be the ID of img element
   //               and if you dont know the image height then set this parameter to -1.
   //               A -1 here triggers a default height of 140px for the header div contsainer, which gets applied immediatley
   //               this is then corrected later in the function when the actual image size has been determined. - #
   //               This isn't ideal but does help stop
   //               jerky header div effect i.e. going from 0 to XXXpx. So tip is dont actually use -1, instead pass in the height of the image.
   //
   // strUseThisImagePathWhenHeaderIsEmpty:
   //
   //               If using a smple image then Specify the url to the image (you can use [siteroot] )              
   function resolveImageHeader(strChildId, intChildHeightToUseWhenEmptyAndComplex, strUseThisImagePathWhenHeaderIsEmpty) 
   {
       // be clever - see if a header image is alreadyassigned.
       // the following checks for the existance of the header img tag which may of been setup and
       // doesnt test for any html in the ctl00_divImage div - we may want to try a different test, i.e grab the ctl00_divImage element and test the length of
       // the innerHTML in this way we dont do anything unless this is empty. umm
       //var exists = $(".imgHeader");
       //if (exists.length == 0)

       // Example
       // resolveImageHeader("imgHeader2", 178, siteroot + '_images/uploads/mythemes/theme1/webdesign.gif');
       // Uses a simple image and doesnt really need to specify the height, but a little trick is to specify it anyway
       // doing so makes the page construction smoother and you dont notice the header element expanding from 0 to XXXpx 

       // Example
       //   resolveImageHeader("divImgChild",211,"");
       //
       // Description: The above example passed a div ID and specifies the height - so its using a complex header.
       var childh = "";
       //debugger;
       //
       // NOTE: this code will only be used if divImage is empty. This allows for page overrides to work. i.e. at page
       // level we can specify a page header image. (see webpages options tab to upload a header image)
       if ($("#ctl00_divImage").attr("innerHTML").length == 0) {

           setParentContainer(document.getElementById(strChildId), 'ctl00_divImage');

           // default of 140px - caller may not know the height if its a complex block of html including  mabe an image
           if (intChildHeightToUseWhenEmptyAndComplex < 0) {
               childh = "140px";
           }
           else {
               childh = intChildHeightToUseWhenEmptyAndComplex + "px";
           }
           
           
           $("#" + strChildId).css("display", "block");
           $("#" + strChildId).css("display", "inline");

           // If caller passes an image use it directly
           if (strUseThisImagePathWhenHeaderIsEmpty != "") {
               //alert("1");
               $('#' + strChildId).attr("src", strUseThisImagePathWhenHeaderIsEmpty);

               //need also to getNumeric the height
               var newImg = new Image();
               newImg.onload = function() {
                   childh = newImg.height + "px";
                   $("#ctl00_divImage").css("display", "block");
                   $("#ctl00_divImage").css("height", childh);
               };
               newImg.src = strUseThisImagePathWhenHeaderIsEmpty;
           }
           else {
               $("#ctl00_divImage").css("display", "block");
               $("#ctl00_divImage").css("height", childh);
           }

       }

   }

   // Display the system clock from themes.
   function SystemClockOn(strClock) {
       setTimeout("SetSystemClockOn('" + strClock  + "')", 100); // SetSystemClockOn(strClock)
   }

   function SetSystemClockOn(strClock) {
       //debugger;
       var clockname = siteroot + "_images/BBCClock.swf";
       if (strClock == "") {
           strClock = clockname;
       }
       var cl = "<object type='application/x-shockwave-flash' id='sysclockclock' class='sysclockclock' data='" + strClock + "' width='102' height='80'><param name='wmode' value='transparent' /><param name='movie' value='"  + strClock + "' /></object>"
       $('.sysclock').html(cl);
       $(".divClockContainer").css("display", "block");

       $(".sysdate").css("display", "block");
   }
   
