﻿function updateSpecSize(specElement) {
    //var myWidth = 0;
    var myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        //myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        //myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    var specHeight = (myHeight - 470);
    document.getElementById(specElement).style.height = specHeight + 'px';
}


var newwin = null;
function doPopup() {
    var tempform = document.forms[0].action
    var temptarget = document.forms[0].target
    window.name = 'websitewindow'
    document.forms[0].orderid.value = document.forms[0].ctl00$ShoppingBasket$BasketCheckout$Wizard1$temporderid.value;
    document.forms[0].amount.value = document.forms[0].ctl00$ShoppingBasket$BasketCheckout$Wizard1$tempamount.value;
    document.forms[0].action = "/pay.asp?returnUrl=" + document.URL
    document.forms[0].target = "paywin";
    newwin = window.open('', 'paywin', 'scrollbars=auto,status=no,resizable=yes,width=600,height=500');
    newwin.focus();
    document.forms[0].submit();
    document.forms[0].action = tempform;
    document.forms[0].target = temptarget;
    return true;
}

function scrollbarWidth() {
    var div = $('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div>');
    // Append our div, do our calculation and then remove it 
    $('body').append(div);
    var w1 = $('div', div).innerWidth();
    div.css('overflow-y', 'scroll');
    var w2 = $('div', div).innerWidth();
    $(div).remove();
    return (w1 - w2);
}

function popup(strUrl,strName,intHeight,intWidth){
    window.open(strUrl,strName,'width=' + intWidth + ',height=' + intHeight+ ',resizable=yes,status=yes,scrollbars=yes,toolbar=no,menubar=no,location=no');
}

function GoNext(SpanThis, ButtonName, ButtonID, loadbutton) {
    if (document.getElementById(ButtonID) != null) {
        if (document.getElementById('load' + ButtonID) == null) {
            document.getElementById(ButtonID).style.display = 'none';
            var fileName = "/gfx/" + loadbutton + ".gif"
            var load = document.createElement('img');
            load.setAttribute('src', fileName);
            load.setAttribute('alt', '');
            load.setAttribute('width', '60');
            load.setAttribute('height', '16');
            //load.setAttribute('width', '43');
            //load.setAttribute('height', '11');

            load.setAttribute('id', 'load' + ButtonID);
            SpanThis.appendChild(load)
        }
    }
}
