function getCSSURL(EcomURL) {
	var EcomList = new Array();
	var CSSList = new Array();
	var i;

	EcomList[0] = "en/index.asp";
	CSSList[0] = "en/home.do";
	EcomList[1] = "tc/index.asp";
	CSSList[1] = "tc/home.do";
	EcomList[2] = "en/d_b04g1c_ebill.asp";
	EcomList[3] = "tc/d_b04g1c_ebill.asp";
	CSSList[2] = "en/viewBill/summary/entry.do";
	CSSList[3] = "tc/viewBill/summary/entry.do";
	EcomList[4] = "en/acctinfo.asp";
	EcomList[5] = "tc/acctinfo.asp";
	CSSList[4] = "en/accountInfo/entry.do";
	CSSList[5] = "tc/accountInfo/entry.do";
	EcomList[6] = "en/RegWS.asp"
	EcomList[7] = "tc/RegWS.asp"
	CSSList[6] = "en/wsRegister/entry.do";
	CSSList[7] = "tc/wsRegister/entry.do";
	EcomList[8] = "en/RegEBC2.asp";
	EcomList[9] = "tc/RegEBC2.asp";
	CSSList[8] = "en/wsRegister/entry.do";
	CSSList[9] = "tc/wsRegister/entry.do";
	EcomList[10] = "en/ApplyDTAcctForm.asp";
	EcomList[11] = "tc/ApplyDTAcctForm.asp";
	CSSList[10] = "en/supplyApplication/DT/entry.do";
	CSSList[11] = "tc/supplyApplication/DT/entry.do";
	EcomList[12] = "en/ApplyGSAcctForm.asp";
	EcomList[13] = "tc/ApplyGSAcctForm.asp";
	CSSList[12] = "en/supplyApplication/GST/entry.do";
	CSSList[13] = "tc/supplyApplication/GST/entry.do";
	EcomList[14] = "en/GrpBillApplyForm.asp";
	EcomList[15] = "tc/GrpBillApplyForm.asp";
	CSSList[14] = "en/groupBill/application/entry.do";
	CSSList[15] = "tc/groupBill/application/entry.do";
	EcomList[16] = "en/ChgEMail.asp";
	EcomList[17] = "tc/ChgEMail.asp";
	CSSList[16] = "en/changeEbillEmail/entry.do";
	CSSList[17] = "tc/changeEbillEmail/entry.do";
	EcomList[18] = "en/ChgCeil.asp";
	EcomList[19] = "tc/ChgCeil.asp";
	CSSList[18] = "en/autopayCeiling/entry.do";
	CSSList[19] = "tc/autopayCeiling/entry.do";
	EcomList[20] = "en/ChgLoadForm.asp";
	EcomList[21] = "tc/ChgLoadForm.asp";
	CSSList[20] = "en/changeLoad/entry.do";
	CSSList[21] = "tc/changeLoad/entry.do";
	EcomList[22] = "en/ChgNameForm.asp";
	EcomList[23] = "tc/ChgNameForm.asp";
	CSSList[22] = "en/changeName/entry.do";
	CSSList[23] = "tc/changeName/entry.do";
	EcomList[24] = "en/ChgPostAddr.asp";
	EcomList[25] = "tc/ChgPostAddr.asp";
	CSSList[24] = "en/changePostalAddress/entry.do";
	CSSList[25] = "tc/changePostalAddress/entry.do";
	EcomList[26] = "en/ChgPwd.asp";
	EcomList[27] = "tc/ChgPwd.asp";
	CSSList[26] = "en/changePwd/entry.do";
	CSSList[27] = "tc/changePwd/entry.do";
	EcomList[28] = "en/Consum.asp";
	EcomList[29] = "tc/Consum.asp";
	CSSList[28] = "en/consumption/entry.do";
	CSSList[29] = "tc/consumption/entry.do";
	EcomList[30] = "en/FeedBackForm.asp";
	EcomList[31] = "tc/FeedBackForm.asp";
	CSSList[30] = "en/feedback/entry.do";
	CSSList[31] = "tc/feedback/entry.do";
	EcomList[32] = "en/ForgotPwdForm.asp";
	EcomList[33] = "tc/ForgotPwdForm.asp";
	CSSList[32] = "en/forgotPassword/entry.do";
	CSSList[33] = "tc/forgotPassword/entry.do";
	EcomList[34] = "en/GrpBillAddForm.asp";
	EcomList[35] = "tc/GrpBillAddForm.asp";
	CSSList[34] = "en/groupBill/addAccount/entry.do";
	CSSList[35] = "tc/groupBill/addAccount/entry.do";
	EcomList[36] = "en/GrpBillDelForm.asp";
	EcomList[37] = "tc/GrpBillDelForm.asp";
	CSSList[36] = "en/groupBill/removeAccount/entry.do";
	CSSList[37] = "tc/groupBill/removeAccount/entry.do";
	EcomList[38] = "en/GBFile.asp";
	EcomList[39] = "tc/GBFile.asp";
	CSSList[38] = "en/groupBill/fileDownload/entry.do";
	CSSList[39] = "tc/groupBill/fileDownload/entry.do";
	EcomList[40] = "en/SubAcctList.asp";
	EcomList[41] = "tc/SubAcctList.asp";
	CSSList[40] = "en/subAccounts/entry.do";
	CSSList[41] = "tc/subAccounts/entry.do";			
	EcomList[42] = "en/AppInspForm.asp";
	EcomList[43] = "tc/AppInspForm.asp";
	CSSList[42] = "en/installationInspection/entry.do";
	CSSList[43] = "tc/installationInspection/entry.do";
	EcomList[44] = "en/OtherReqForm.asp";
	EcomList[45] = "tc/OtherReqForm.asp";
	CSSList[44] = "en/otherSvcReq/entry.do";
	CSSList[45] = "tc/otherSvcReq/entry.do";			
	EcomList[46] = "en/RptMeter.asp";
	EcomList[47] = "tc/RptMeter.asp";
	CSSList[46] = "en/mtrRead/entry.do";
	CSSList[47] = "tc/mtrRead/entry.do";			
	EcomList[48] = "en/login.asp";
	EcomList[49] = "tc/login.asp";
	CSSList[48] = "en/loginpage.do";
	CSSList[49] = "tc/loginpage.do";			
	EcomList[50] = "en/logout.asp";
	EcomList[51] = "tc/logout.asp";
	CSSList[50] = "en/logout.do";
	CSSList[51] = "tc/logout.do";			
	EcomList[52] = "en/TariffCalcBT.asp";
	EcomList[53] = "tc/TariffCalcBT.asp";
	CSSList[52] = "en/tariffCalculation/BT/entry.do";
	CSSList[53] = "tc/tariffCalculation/BT/entry.do";
	EcomList[54] = "en/TariffCalcDT.asp";
	EcomList[55] = "tc/TariffCalcDT.asp";
	CSSList[54] = "en/tariffCalculation/DT/entry.do";
	CSSList[55] = "tc/tariffCalculation/DT/entry.do";
	EcomList[56] = "en/TariffCalcGST.asp";
	EcomList[57] = "tc/TariffCalcGST.asp";
	CSSList[56] = "en/tariffCalculation/GST/entry.do";
	CSSList[57] = "tc/tariffCalculation/GST/entry.do";
	EcomList[58] = "en/TariffCalcLPT.asp";
	EcomList[59] = "tc/TariffCalcLPT.asp";
	CSSList[58] = "en/tariffCalculation/LPT/entry.do";
	CSSList[59] = "tc/tariffCalculation/LPT/entry.do";
	EcomList[60] = "en/TermAcctForm.asp";
	EcomList[61] = "tc/TermAcctForm.asp";
	CSSList[60] = "en/supplyTermination/entry.do";
	CSSList[61] = "tc/supplyTermination/entry.do";
	EcomList[62] = "en/GrpBillTermForm.asp";
	EcomList[63] = "tc/GrpBillTermForm.asp";
	CSSList[62] = "en/groupBill/termination/entry.do";
	CSSList[63] = "tc/groupBill/termination/entry.do";
	EcomList[64] = "en/SRIndex.asp";
	EcomList[65] = "tc/SRIndex.asp";
	CSSList[64] = "en/svcReqMenu.do";
	CSSList[65] = "tc/svcReqMenu.do";

	for (i=0; i < EcomList.length; i++) {
		if (EcomURL.toLowerCase() == EcomList[i].toLowerCase()) {
			return CSSList[i];
		}
	}	
	return "";
}

/*
function showEcom( theURL ) 
{
	var newpath;
	var newwindow;
	var newURL;
	var context = "ws/";

	newURL = getCSSURL(theURL);
	newpath = 'https://www1.clpgroup.com/' + context + newURL;
	newwindow = window.open( newpath, 'CLPWS' , 'scrollbars=yes,resizable=yes,toolbar=no,titlebar=no,location=no,menubar=yes,width=800,height=560,top=0,left=0');
	if (newwindow != null) {
		newwindow.focus();
	}
}
*/

function popWindow(mypage,myname,mywidth,myheight)
{
	if (mywidth == null)	{
		mywidth = 800;
	}	
	if (myheight == null) {
		myheight = 500;
	}
	
	var settings='scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes' + ',width=' + mywidth + ',height=' + myheight + ',top=50,left=10';

	var winpop=window.open(mypage,myname,settings);
	if (winpop != null) {
		winpop.focus();
	}
}

function popToolBarWindow(mypage,myname,mywidth,myheight)
{
	if (mywidth == null)	{
		mywidth = 800;
	}	
	if (myheight == null) {
		myheight = 500;
	}
	
	var settings='scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=yes,resizable=yes' + ',width=' + mywidth + ',height=' + myheight + ',top=50,left=10';

	var winpop=window.open(mypage,myname,settings);
	if (winpop != null) {
		winpop.focus();
	}
}


function popEnSurvey()
{
	if (getCookie('feedbackform')==null)
	{
 	setPopCookie('feedbackform', 'yes', 1);
	popbackWindow("http://www.chinalightandpower.com.hk/NR/clp/en/feedback/survey0602/index.htm","survey",800,500);
	}
}

function popTcSurvey()
{
	if (getCookie('feedbackform')==null)
	{
	setPopCookie('feedbackform', 'yes', 1);
	popbackWindow("http://www.chinalightandpower.com.hk/NR/clp/tc/feedback/survey0602/index.htm","survey",800,500);
	}
}

function popbackWindow(mypage,myname,mywidth,myheight)
{
	var settings='scrollbars=yes,location=no,directories=no,status=yes,menubar=yes,toolbar=no,resizable=yes' + ',width=' + mywidth + ',height=' + myheight + ',top=150,left=150';

	var win=window.open(mypage,myname,settings);
	if (win != null) {
		win.blur();
	}
}
