// Support Script (674)
function colorAsRGBHex(s)
{
	return swapRedBlue(colorAsHex(s));
}

function colorAsHex(s)
{
	lColor = parseColor(s);
	color = lColor.toString(16);
	while (color.length < 6)
		color = "0" + color;

	return color;
}

function swapRedBlue(s)
{
	retColor = s;
	if (s.length == 6 && !isNaN(parseInt("0x" + s)))
	{
			r = s.substr(4,2);
			g = s.substr(2,2);
			b = s.substr(0,2);
			retColor = r + g + b;
	}
	else alert("swapRedBlue: Illegal input " + s);

	return retColor;
}

function parseColor(s)
{
	sInit = s;
	retColor = 0x0F000000;  // illegal color value

	s = s.replace(/^\s+/, "");  // trim leading and trailing white space
	s = s.replace(/\s+$/, "");

	if (s.substr(0,3) == "rgb")     // rgb(rrr,ggg,bbb)
		s = s.substr(3, s.length);

	if (s.substr(0,1) == "(")       // (rrr,ggg,bbb)
	{
		s = s.substr(0, s.length -1);
		s = s.substr(1, s.length -1);
		rgb = s.split(",");
		retColor = parseInt(rgb[0])*0x10000 + parseInt(rgb[1])*0x100 + parseInt(rgb[2]);
	}
	else
	{
		if (s.charAt(0) == "#")                          // #rrggbb
		{
			s = s.substr(1,6);
			retColor = parseInt("0x" + s);
		}
		else
		{
			if (s.substr(0,2) == "0x" && s.length > 2)       // Oxrrggbb OR 0xHHH (not 6 digit hex)
			{
				s = s.substr(2, s.length);
				retColor = parseInt("0x" + s);
			}
			else
			{
				if (!isNaN(parseInt(s)))                       // ddddddd (decimal) OR 0xrrggbb (hex)
				{
					retColor = parseInt(s);
				}
			}
		}
	}

	if (isNaN(retColor) || retColor == 0x0F000000)
	{
		retColor = 0xC0C0C0;
		alert("parseColor: color value not parsed (using default gray) " + sInit);
	}

	return retColor;
}

// Support Script (944)
function OpenCustomWindow(strPage,strName,iWidth,iHeight,bLocation,bMenuBar,bResizable,bScrollBars,bStatus,bToolBar,bDirectories,iTop,iLeft,strPosition,bAdjust,strOpenerName,bDefualt,strSize) {
    var strTemp = ''
    var strOptions = ''
    var _winPopUp
    var strOpenerName = (String(strOpenerName)!='undefined' && String(strOpenerName)!='') ? strOpenerName : 'mainWindow'
    strOptions += 'status='+((bStatus=='1')?'yes':'no')
    strOptions += ',directories='+((bDirectories=='1')?'yes':'no')
    strOptions += ',location='+((bLocation=='1')?'yes':'no')
    strOptions += ',toolbar='+((bToolBar=='1')?'yes':'no')
    strOptions += ',menubar='+((bMenuBar=='1')?'yes':'no')
    strOptions += ',scrollbars='+((bScrollBars=='1')?'yes':'no')
    strOptions += ',resizable='+((bResizable=='1')?'yes':'no')
    strOptions += ',fullscreen='+((strSize=='Full Screen')?'yes':'no')

    if (strSize!='undefined' && strSize!='' && strSize!='Specified' && strSize!='Default' && strSize!='Full Screen') {
        strTemp = dbiSetWindowSize(strSize,bAdjust)
        strTemp = String(strTemp).split('-')
        iWidth = strTemp[0]
        iHeight = strTemp[1]
    }

    if (strPosition!='undefined' && strPosition!='' && strPosition!='Specified' && strPosition!='Default') {
        if (parseInt(iWidth) > 0 && parseInt(iHeight) > 0) {
            var iTopTemp = parseFloat(iTop)
            var iLeftTemp = parseFloat(iLeft)
            strTemp = dbiGetWindowPosition(iWidth,iHeight,strPosition,bAdjust)
            strTemp = String(strTemp).split('-')
            iTop = parseFloat(strTemp[0]) + iTopTemp
            iLeft = parseFloat(strTemp[1]) + iLeftTemp
        }
    }

    if (strSize=='Default') {
        iWidth = -1
        iHeight = -1
    }

    if (strPosition=='Default') {
        iTop = -1
        iLeft = -1
    }

    if (parseInt(iWidth)  > 0) strOptions += ',width='+iWidth
    if (parseInt(iHeight) > 0) strOptions += ',height='+iHeight
    if (parseInt(iTop) >= 0)  strOptions += ',top='+iTop +',screenY='+iTop
    if (parseInt(iLeft) >= 0) strOptions += ',left='+iLeft + ',screenX='+iLeft

    strOptions = (bDefualt==1) ? '' : strOptions

    strPage = (String(strPage)!='undefined') ? strPage : ''

    window.name = strOpenerName
    _winPopUp = window.open(strPage,strName,strOptions)
    _winPopUp.opener = window
    _winPopUp.opener.name = window.name
    _winPopUp.focus()
}

function dbiGetWindowPosition(iWidth,iHeight,strPosition,bAdjust) {

    var strOut = ''
    var iScreenHeight = parseInt(screen.height)
    var iScreenWidth= parseInt(screen.width)
    var iTop = 0
    var iLeft = 0
    var iOffsetTop = 0
    var iOffsetLeft = 0
    if (bAdjust==1) {
         iOffsetTop = -59
         iOffsetLeft = -10
    }
    strPosition = String(strPosition).toLowerCase()

    switch(strPosition) {

        case 'bottom center':
            iTop = parseInt(iScreenHeight - iHeight) + iOffsetTop
            iLeft = parseInt((iScreenWidth - iWidth + iOffsetLeft)/2)
            break
        case 'bottom left':
            iTop = parseInt(iScreenHeight - iHeight) + iOffsetTop
            iLeft = 0
            break
        case 'bottom right':
            iTop = parseInt(iScreenHeight - iHeight) + iOffsetTop
            iLeft = parseInt(iScreenWidth - iWidth) + iOffsetLeft
            break
        case 'center':
            iTop = parseInt((iScreenHeight - iHeight + iOffsetTop)/2)
            iLeft = parseInt((iScreenWidth - iWidth + iOffsetLeft)/2)
            break
        case 'middle left':
            iTop = parseInt((iScreenHeight - iHeight + iOffsetTop)/2)
            iLeft = 0
            break
        case 'middle right':
            iTop = parseInt((iScreenHeight - iHeight + iOffsetTop)/2)
            iLeft = parseInt(iScreenWidth - iWidth) + iOffsetLeft
            break
        case 'top center':
            iTop = 0
            iLeft = parseInt((iScreenWidth - iWidth + iOffsetLeft)/2)
            break
        case 'top left':
            iTop = 0
            iLeft = 0
            break
        case 'top right':
            iTop = 0
            iLeft = parseInt(iScreenWidth - iWidth) + iOffsetLeft
            break
    }
    strOut = '' + iTop + '-' + iLeft
    return strOut
}


function dbiSetWindowSize(strSize,bAdjust) {

    var strOut = ''
    var iScreenWidth = parseInt(screen.width)
    var iScreenHeight = parseInt(screen.height)
    var iWidth = 0
    var iHeight = 0

    strSize = String(strSize).toLowerCase()

    if (bAdjust==1) {
        iScreenHeight = (strSize=='1/4') ? iScreenHeight - 144 : iScreenHeight
        iScreenWidth = (strSize=='1/4') ? iScreenWidth - 40 : iScreenWidth
        iScreenHeight = (strSize=='1/2') ? iScreenHeight - 88 : iScreenHeight
        iScreenWidth = (strSize=='1/2') ? iScreenWidth - 20 : iScreenWidth
        iScreenHeight = (strSize=='3/4') ? iScreenHeight - 69 : iScreenHeight
        iScreenWidth = (strSize=='3/4') ? iScreenWidth - 12 : iScreenWidth
        iScreenHeight = (strSize=='maximized') ? iScreenHeight - 59 : iScreenHeight
        iScreenWidth = (strSize=='maximized') ? iScreenWidth - 10 : iScreenWidth
    }

    switch(strSize) {

        case '1/4':
            iHeight = parseInt((iScreenHeight)/4)
            iWidth = parseInt((iScreenWidth)/4)
            break
        case '1/2':
            iHeight = parseInt((iScreenHeight)/2)
            iWidth = parseInt((iScreenWidth)/2)
            break
        case '3/4':
            iHeight = parseInt((iScreenHeight)*.75)
            iWidth = parseInt((iScreenWidth)*.75)
            break
        case 'maximized':
            iHeight = parseInt(iScreenHeight)
            iWidth = parseInt(iScreenWidth)
            break
    }
    strOut = '' + iWidth + '-' + iHeight
    return strOut
}
function document_onLoad() {
var sbcolor = colorAsRGBHex("15724527");
sbcolor = '#'+sbcolor;
changeScrollbarColor(sbcolor)
 }
function Image6_onClick() {
var options="";
options+="status="+(("0"=="1")?"yes":"no")
options+=",directories="+(("0"=="1")?"yes":"no")
options+=",location="+(("0"=="1")?"yes":"no")
options+=",toolbar="+(("0"=="1")?"yes":"no")
options+=",menubar="+(("0"=="1")?"yes":"no")
options+=",scrollbars="+(("0"=="1")?"yes":"no")
options+=",resizable="+(("1"=="1")?"yes":"no")

if (parseInt("795")  > 0) options+=",width="+"795"
if (parseInt("500") > 0) options+=",height="+"500"

if (parseInt("-4") >= 0)
{
	options+=",top="+"-4"
	options+=",screenY="+"-4"
}
if (parseInt("-4") >= 0)
{
	options+=",left="+"-4"
	options+=",screenX="+"-4"
}

page = "";
if (page.length == 0) page = "chi.asp";

window.open(page,"NewWindow",options);
 }
function _Image6_onClick() { if (Image6) return Image6.onClick(); }
function Marche__onChange() {
var v = Marche.getSelectedValue();
if (v.length > 1) // one char is a noop
  window.location.href = v;
 }
function _Marche__onChange() { if (Marche) return Marche.onChange(); }
function liveHelp_onClick() {
var strPage = ("http://lignedirecte.ca/lspe/prechat.html?d=ldt6554&g=support"!="") ? "http://lignedirecte.ca/lspe/prechat.html?d=ldt6554&g=support" : "index.asp"
var strName = "popup"
OpenCustomWindow(strPage,strName,"380","480","0","0","1","1","0","0","0","50","240","Specified","0","mainWindow","0","Specified")
 }
function _liveHelp_onClick() { if (liveHelp) return liveHelp.onClick(); }
function liveHelp_onMouseOver() {
window.status="Live Help ";
return true;
 }
function _liveHelp_onMouseOver() { if (liveHelp) return liveHelp.onMouseOver(); }
function liveHelp_onMouseOut() {
window.status="";
return true;
 }
function _liveHelp_onMouseOut() { if (liveHelp) return liveHelp.onMouseOut(); }

