// ****** Please change variables below ******
var EServiceID 		= "E010033";

// ****** Please do not touch the code below ******

/**services2.hdb.gov.sg **/
var esvcDb   = "fi10/fi10295p.nsf";
var hdbInfoImg     = "http://www.hdb.gov.sg"; // https
var hdbInfoLnk     = "http://www.hdb.gov.sg"; // http

var iwebIntranet = false;

// ***** SPINS *****
var spinsHost  = "https://services2.hdb.gov.sg";
// ***** SPINS *****

// ***** SPINS *****
if (!spinsLoaded) var spinsLoaded = false;
var spinsIsInSession = false;

document.write('<scr'+'ipt src="' +spinsHost+ '/webapp/BF02SPINS2/script/session_handler.js" type="text/javascript"></scr'+'ipt>');

function logoutClick() {
	if (spinsLoaded) {
		spinsLogoutClick();
		return;
	}
	if (confirm('Would you like to log out of the session now?')) {
		self.location.href = spinsHost + "/webapp/BF02SPINS2/BF02SSPINSLogoutServlet";
	}
}
// ***** SPINS *****


var linktoEPoll	= hdbInfoLnk +"/be06/be06020p.nsf/BE06M06AgtRateEService?OpenAgent&EServiceID="+EServiceID;
var linktoFeedbackForm = "";

var hdbIWebLayout  = hdbInfoImg+"/"+ esvcDb + "/ImageView/LAYOUT_WIS2/$file/layout_wis.js";
var esvccss		   = hdbInfoImg+"/"+ esvcDb + "/ImageView/ESERVICES/$file/eservices.css";

if (window.location.protocol=="file:") var hdbFileLocal = true;
if (!hdbFileLocal) {
  	document.write('<scr'+'ipt src="' +hdbIWebLayout+ '" type="text/javascript"></scr'+'ipt>');
} else {
	document.write('<scr'+'ipt src="./js/layout_wis.js" type="text/javascript"></scr'+'ipt>'); // LOCAL-ONLY
}

var hdbImgVw = hdbInfoImg + "/" + esvcDb + "/ImageView/"; 
var jQry = hdbImgVw + "JQUERYESERVICES/$file/jquery-1.2.6.js";
document.write('<script src="' + jQry + '" type="text/javascript"></script>');

// For Custmer Satisfaction Poll
function getEPoll(){
window.open(linktoEPoll,'EPoll','width=600,height=650,status=no,resizable=no,scrollbars=yes,menubar=no,toolbar=no');
return false;
}

function getStatusEPoll(){
document.getElementById("estatus").href = linktoEPoll;
}

// For Centralised Feedback Form
function getFdBkForm(emailadd,oic){
//linktoFeedbackForm = "http://www.hdb.gov.sg" + "/pc14/isos0174p.nsf/BE05CFeedback?OpenForm&FB_Subject=E-Service&FB_EServiceID="+EServiceID;
linktoFeedbackForm = hdbInfoLnk + "/pc14/isos0174p.nsf/BE05CFeedback?OpenForm&FB_Subject=E-Service&FB_EServiceID="+EServiceID;
if (!emailadd)   var emailadd   = "";
if (!oic)   var oic   = "";
if(emailadd!=""){linktoFeedbackForm=linktoFeedbackForm+"&FB_MailAddr="+emailadd;}
if(oic!=""){linktoFeedbackForm=linktoFeedbackForm+"&FB_OIC="+oic;}
window.open(linktoFeedbackForm,'FeedBackform','top=5, left=0, height=650, width=800, scrollbars=yes, menubar=no,toolbar=no');
}

function getStatusFdBkForm(emailadd,oic){
//linktoFeedbackForm = "http://www.hdb.gov.sg" + "/pc14/isos0174p.nsf/BE05CFeedback?OpenForm&FB_Subject=E-Service&FB_EServiceID="+EServiceID;
linktoFeedbackForm = hdbInfoLnk + "/pc14/isos0174p.nsf/BE05CFeedback?OpenForm&FB_Subject=E-Service&FB_EServiceID="+EServiceID;
document.getElementById("fdstatus").href = linktoFeedbackForm;
}

// For Printer Friendly Page
function printPortalPage(){
var prin=window.open('PrinterDisplay.jsp','_blank','toolbar=no, directories=no, location=no,status=yes, menubar=yes, resizable=yes, scrollbars=yes,width=680, height=500');
var hdbcorpimg = hdbInfoImg+"/"+ esvcDb + "/ImageView/HDB_CORP/$file/hdbcorp.gif";
var temp ="<link rel='stylesheet' href='"+esvccss+"' type='text/css'>";
var temp1 ="<style media='print'>.printHidden { display:none; }</style>";
prin.document.write('<html><head>'+temp+temp1+'<title>E-Services Printer Friendly page</title><body leftmargin="0" topmargin="0">');
prin.document.write('<br><table><tr><td align="left"><IMG border="0" src="'+hdbcorpimg+'" width="192" height="50"></td></tr><tr><td class=printHidden width="100%"><br>');
prin.document.write('<a href="#" onclick="window.print();return false;">Print This Page</a></td></tr></table><br>');
prin.document.write(document.getElementById("print").innerHTML);
var x="";
var ar=prin.document.getElementsByTagName("Table");
var at=prin.document.getElementsByTagName("HR");
var ax=prin.document.getElementsByTagName("IMG");
for (var i=0;i<ar.length;i++) {if(ar[i].width >604)ar[i].width=604;} 
for (var i=0;i<at.length;i++) {if(at[i].width >604)at[i].width=604;}
for (var i=0;i<ax.length;i++) {
if(ax[i].width >604){
x=((ax[i].width)-604)/(ax[i].width);
x=x*100;
ax[i].width=604;
ax[i].height=(ax[i].height)*(100-x)/100;}
}
prin.document.write('</body></head></html>');
prin.document.close();
}

function printNonPortalPage(){
var prin=window.open('PrinterDisplay.jsp','_blank','toolbar=no, directories=no, location=no,status=yes, menubar=yes, resizable=yes, scrollbars=yes,width=680, height=500');
var hdbcorpimg = hdbInfoImg+"/"+ esvcDb + "/ImageView/HDB_CORP/$file/hdbcorp.gif";
var temp ="<link rel='stylesheet' href='"+esvccss+"' type='text/css'>";
var temp1 ="<style media='print'>.printHidden { display:none; }</style>";
prin.document.write('<html><head>'+temp+temp1+'<title>E-Services Printer Friendly page</title><body leftmargin="0" topmargin="0">');
prin.document.write('<br><table><tr><td align="left"><IMG border="0" src="'+hdbcorpimg+'" width="192" height="50"></td></tr><tr><td class=printHidden width="100%"><br>');
prin.document.write('<a href="#" onclick="window.print();return false;">Print This Page</a></td></tr></table><br>');
prin.document.write(document.getElementById("print").innerHTML);
var x="";
var ar=prin.document.getElementsByTagName("Table");
var at=prin.document.getElementsByTagName("HR");
var ax=prin.document.getElementsByTagName("img");
for (var i=0;i<ar.length;i++) {if(ar[i].width >650)ar[i].width=650;} 
for (var i=0;i<at.length;i++) {if(at[i].width >650)at[i].width=650;}
for (var i=0;i<ax.length;i++) {
if(ax[i].width >650){
x=((ax[i].width)-650)/(ax[i].width);
x=x*100;
ax[i].width=650;
ax[i].height=(ax[i].height)*(100-x)/100;}
}		
prin.document.write('</body></head></html>');
prin.document.close();
}