// JavaScript Document

var leavingSiteMSG = "You are now leaving volunteers.gsk.co.uk and moving to a website that is not controlled by GlaxoSmithKline. \nGlaxoSmithKline cannot be held responsible for any content or advice contained on this website";

function leavingGSK(url) {
    if (confirm(leavingSiteMSG)) {
        window.location = url;
    }
}


function get_objType(objName) {
    if (document.getElementById)
        var x = document.getElementById(objName);
    else if (document.all)
        var x = document.all(objName);
    else return;
    return x;
}
var newWindow;
//url supplied from flash
function fLinks(x) {
    //popping up a new window... and re-using/bring to front if already active
    if (!newWindow || newWindow.closed) {
        newWindow = window.open(x, "subwind");
    } else {
        //window is already open, so bring it to the front
        newWindow.location.href = x;
        newWindow.focus();
    }
}
function textCounter(field, countfield, maxlimit) {
    var output = get_objType(countfield);

    if (output == null) { return; }

    if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);
    output.innerHTML = maxlimit - field.value.length;
}
function stripSpacesFromFileName(filename) {
    var newfilename = "";
    var re = new RegExp(" ", 'gi');
    var re_20 = new RegExp("%20", 'gi');
    //if (filename != null || filename.length > 0) {
    // {
    if (filename != null) {
        if (filename.length > 0)
        newfilename = filename.replace(re, '').replace(re_20, '');
    }
    return newfilename;

}
//var blank = new Image();
//blank.src = localURL + 'assets/images/spacer.gif';

var ie56 = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");

function pngFix() {
    for (var i = 0; i < document.images.length; i++) {
        var img = document.images[i]
        var imgName = img.src.toUpperCase()
        if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {


            var imgClass = "";
            var imgTitle = "";
            if (img.className)
                imgClass = "class='" + img.className + "' ";
            if (img.title)
                imgTitle = "title='" + img.title + "' ";
            var imgStyle = "display:inline-block;" + img.style.cssText
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
            img.outerHTML = strNewHTML
            i = i - 1

        }
    }
}

//var orig_WebForm_DoPostBackWithOptions = WebForm_DoPostBackWithOptions;

