// This function should detect opener and open corp web
function SmarToneVodafone(sLang) {
	var sPage = "http://www.smartone-vodafone.com/jsp/" + sLang + "/index.jsp";
	LaunchIt(sPage);
}

// This function should detect opener and open Forget Pin page at myaccount
function LaunchForgetPIN(sLang) {
	var sPage = "https://myaccount.homephoneplus.com/jsp/fl_mya/fl_mya_forPwd.jsp?language=E&sid=2";
	if (sLang == "tchinese") {
		sPage = "https://myaccount.homephoneplus.com/jsp/fl_mya/fl_mya_forPwd.jsp?language=C&sid=2";
	}
	PopUp(sPage, "ForgetPin", 600, 530, false);
}

// This function should detect opener and open Change Pin page at myaccount
function LaunchChangePIN(sLang) {
	var sPage = "https://myaccount.homephoneplus.com/jsp/fl_mya/fl_mya_chgPwd.jsp?language=E&sid=2";
	if (sLang == "tchinese") {
		sPage = "https://myaccount.homephoneplus.com/jsp/fl_mya/fl_mya_chgPwd.jsp?language=C&sid=2";
	}
	PopUp(sPage, "ChangePin", 600, 425, false);
}

function LaunchIt(sPage) {
	try {
		var oTop = top.opener;

		if (oTop) {
			oTop.top.location.href = sPage;
			oTop.focus();
		} else {
			window.open(sPage);
		}
	} catch (error) {
		window.open(sPage);
	}
}

function PopUp(sURL, sWinName, iWidth, iHeight, bMenu) {
	var sStr;
	if (bMenu) {
		sStr = "width=" + iWidth + ",height=" + iHeight + ",left=0,top=0,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,fullscreen=no";
	} else {
		sStr = "width=" + iWidth + ",height=" + iHeight + ",left=0,top=0,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,fullscreen=no";
	}
	var newwin = window.open(sURL, sWinName, sStr);
	if (newwin != null) newwin.focus();
	else alert("Please enable popup");
}

function PopUpWithStatus(sURL, sWinName, iWidth, iHeight, bMenu) {
     var sStr;
     if (bMenu) {
		sStr = "width=" + iWidth + ",height=" + iHeight + ",left=0,top=0,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,fullscreen=no";
     } else {
		sStr = "width=" + iWidth + ",height=" + iHeight + ",left=0,top=0,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,fullscreen=no";
     }
     var newwin = window.open(sURL, sWinName, sStr);
     if (newwin != null) newwin.focus();
	else alert("Please enable popup");
}

