/*

   © 2004 Cordys R&D B.V. All rights reserved.
   The computer program(s) is the proprietary information of Cordys R&D B.V. and provided
	under the relevant License Agreement containing restrictions on use and disclosure.
	Use is subject to the License Agreement.

  Project    : 
  File Name  : system.js
  Description : 
  
  BASEGATEWAYURL  -  Web application which registers the user.
*/

window.isSystem = true;

var BASEGATEWAYURL = "Cordys/com.eibus.web.soap.Gateway.wcp?organization=o=B2C,cn=cordys,o=tatamotors.com";

window.isIE = window.navigator.appVersion.match(/MSIE ([0-9.]*);/) != null;
window.isFirefox = window.navigator.userAgent.indexOf("Mozilla/5.0") == 0;
window.isSafari = window.navigator.userAgent.indexOf("Safari") != - 1;
window.isChrome = window.navigator.userAgent.indexOf("Chrome/0.4.154.29") != - 2;
window.isOpera = window.navigator.userAgent.indexOf("Opera/9.50") != - 3;
window.isNavigator = window.navigator.userAgent.indexOf("Navigator/9.0.0.6") != - 4;

var myAscertion;

// lowest level send Protocol. Deals only with HTTP Errors. Do not use directly
function sendHttpRequest(request, url)
{
	// let us add assertions
	system.SSO.addAssertions(request);

	var xmlhttpObject = null;

	if (window.isIE)
	{
		xmlhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.isFirefox)
	{
		xmlhttpObject = new XMLHttpRequest();
	}
	else if(window.isChrome)
	{
		xmlhttpObject = new XMLHttpRequest();
	}
	else if(window.Safari)
	{
		xmlhttpObject = new XMLHttpRequest();
	}
	else
	{
		xmlhttpObject = new XMLHttpRequest();
	}

	if (! xmlhttpObject)
	{
		return alert("Creation of XMLHttpObject Failed. from send");
	}

	xmlhttpObject.open("POST", url, false);

	try
	{
		xmlhttpObject.send(request);
	}
	catch (httpError)
	{
		var errorMessage = "Cannot contact the web server. ";

		if (httpError.number == - 2146697208)
		{
			errorMessage += "Check the browser settings for working offline";
		}
		else if (httpError.number == - 2146697211)
		{
			errorMessage += "Check whether it is running";
		}
		else
		{
			errorMessage += "The error code is " + event.error.number;
		}
		alert(errorMessage + ". Please try again later.");
		return null;
	}

	if ((! xmlhttpObject.responseXML) || (! xmlhttpObject.responseXML.documentElement))
	{
		alert("There was error in sending the request. Please try again later. Response is " + xmlhttpObject.responseText);
		return null;
	}
	return xmlhttpObject.responseXML;
}

// sends the request to the backend after adding session and other details with error handling
function send(request)
{
	return sendHttpRequest(request, BASEGATEWAYURL);
}
function send1(request,func)
{
	return sendHttpRequest1(request, BASEGATEWAYURL,func);
}


function sendHttpRequest1(request, url,func)
{
	// let us add assertions
	system.SSO.addAssertions(request);
	http_request = null;

	if (window.isIE)
	{
		http_request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.isFirefox)
	{
		http_request = new XMLHttpRequest();
	}
	else
	{
		http_request = new XMLHttpRequest();
	}

	if (! http_request)
	{
		return alert("Creation of XMLHttpObject Failed. from send 1");
	}
	http_request.onreadystatechange = func;
	http_request.open("POST", url, true);
	http_request.setRequestHeader("Content-type", "text/xml");
	http_request.setRequestHeader("Connection", "close");
      	      
	try
	{
		http_request.send(request);
	}
	catch (httpError)
	{
		var errorMessage = "Cannot contact the web server. ";

		if (httpError.number == - 2146697208)
		{
			errorMessage += "Check the browser settings for working offline";
		}
		else if (httpError.number == - 2146697211)
		{
			errorMessage += "Check whether it is running";
		}
		else
		{
			errorMessage += "The error code is " + event.error.number;
		}
		alert(errorMessage + ". Please try again later.");
		return null;
	}

	if ((! http_request.responseXML) || (! http_request.responseXML.documentElement))
	{
		//alert("There was error in sending the request. Please try again later. Response is " + http_request.responseText);
		return null;
	}
	
	//return http_request.responseXML;
}

// Returns the value of the parameter if it is in the url of this window
function getParameter(parameterName, defaultValue, windowObject)
{
	windowObject = windowObject ? windowObject : window;
	if (windowObject.location.search.match(new RegExp("[\?\&]" + parameterName + "=([^\&]*)"))) return unescape(RegExp.$1);
	return defaultValue;
}


// XML Helper constructor.
function XMLHelper()
{
}

XMLHelper.getXMLDocument = function(doc)
{
	// code for IE
	if (window.isIE)
	{
		var docXML = new ActiveXObject("Microsoft.XMLDOM");
		docXML.async = "false";
		docXML.loadXML(doc);
		return docXML;
	}
	// code for Firefox
	else
	{
		var parser = new DOMParser();
		return parser.parseFromString(doc, "text/xml");
	}
}

if (! window.isIE)
{
	XMLDocument.prototype.addSelectionNameSpace = function(prefix, namespace)
	{
		if (! this.namespaces)
		{
			this.namespaces = new Array();
		}
		this.namespaces[prefix] = namespace;
	}

	XMLDocument.prototype.namespacesResolver = function(prefix)
	{
		var doc = this;
		var resolver =
			{
			namespaces: doc.namespaces,
			normalResolver: doc.createNSResolver(doc.documentElement),
			lookupNamespaceURI: function(prefix)
			{
				if (prefix in (XMLDocument.globalNamespaces || {
		})) return XMLDocument.globalNamespaces[prefix];

				if (prefix in (this.namespaces || {
		})) return this.namespaces[prefix];

				return this.normalResolver.lookupNamespaceURI(prefix);
			}
			}
		return resolver;
	}

	XMLDocument.globalNamespaces =
		{
		soap: 'http://schemas.xmlsoap.org/soap/envelope/',
		SOAP: 'http://schemas.xmlsoap.org/soap/envelope/',
		xsd: 'http://www.w3.org/2001/XMLSchema',
		xsi: 'http://www.w3.org/2001/XMLSchema-instance',
		toString: function()
		{
			var a = new Array();

			for (var ns in this)
			{
				if (typeof this[ns] != 'function')
				{
					a[a.length] = 'xmlns:' + ns + '="' + this[ns] + '"';
				}
			}
			return a.join(' ');
		}
		}
}

// sets the text value at the element satisfying the searchpath if any
XMLHelper.setNodeText = function(node, searchPath, value)
{
	if (! node) return;

	var searchedNode = XMLHelper.selectSingleNode(node, searchPath);

	if (searchedNode)
	{
		if (window.isIE)
		{
			searchedNode.text = value;
		}
		else
		{
			searchedNode.textContent = value;
		}
	}

	return searchedNode;
}


// returns the text value of the node selected using the searchPath
XMLHelper.getNodeText = function(node, searchPath, defaultValue)
{
	if (! node) return defaultValue;

	var searchedNode;

	if (! searchPath)
	{
		// let us return the text of the node passed in case there is no searchpath specified
		searchedNode = node;
	}
	else
	{
		searchedNode = XMLHelper.selectSingleNode(node, searchPath);
	}

	if (searchedNode)
	{
		if (window.isIE)
		{
			return searchedNode.text;
		}
		else
		{
			return searchedNode.textContent;
		}
	}
	else
	{
		return defaultValue;
	}
}

// function sets an attribute of a node.
XMLHelper.setAttribute = function(xmlNode, xPath, name, value)
{
	if (! xmlNode) return;

	var searchedNode = XMLHelper.selectSingleNode(xmlNode, xPath);

	if (searchedNode)
	{
		searchedNode.setAttribute(name, value);
	}
}

// function gets an attribute of a node.
XMLHelper.getAttribute = function(xmlNode, xPath, name, defaultValue)
{
	if (! xmlNode) return;

	var searchedNode = XMLHelper.selectSingleNode(xmlNode, xPath);
	var nodeValue;

	if (searchedNode)
	{
		nodeValue = searchedNode.getAttribute(name);
	}

	if (! nodeValue)
	{
		nodeValue = defaultValue;
	}

	return nodeValue;
}

// function creates an XML Node and optionally sets the text
// returns the newly created node
XMLHelper.createElement = function(xmlNode, tagName, value, namespace)
{
	if (! namespace)
	{
		var newNode = xmlNode.ownerDocument.createElement(tagName);
	}
	else
	{
		if (window.isIE)
		{
			newNode = xmlNode.ownerDocument.createNode(1, tagName, namespace);
		}
		else
		{
			newNode = xmlNode.ownerDocument.createElementNS(namespace, tagName);
		}
		return newNode;
	}

	XMLHelper.appendChild(xmlNode, newNode);

	if (value)
	{
		if (window.isIE)
		{
			newNode.text = value;
		}
		else
		{
			newNode.textContent = value;
		}
	}

	return newNode;
}

// function creates an XML Node, after checking whether it exists
// and optionally sets the text and returns the newly created/already existing node
XMLHelper.createElementIfNotExists = function(xmlNode, tagName, value, namespace)
{
	if (! xmlNode) return;

	var searchedNode = XMLHelper.selectSingleNode(xmlNode, tagName);

	if (! searchedNode)
	{
		searchedNode = XMLHelper.createElement(xmlNode, tagName, value, namespace);
	}

	if (value)
	{
		searchedNode.text = value;
	}

	return searchedNode;
}

// function gets all nodes with XPath.
XMLHelper.selectNodes = function(xmlNode, xPath)
{
	var searchedNodes = new Array();
	
	if (! (xmlNode && xPath)) return searchedNodes;

	

	if (/^[A-Za-z0-9_:]+$/.test(xPath))
	{
		searchedNodes = xmlNode.getElementsByTagName(xPath);
		return searchedNodes;
	}

	if (window.isIE)
	{
		var searchedNodes = xmlNode.selectNodes(xPath);
	}
	else
	{
		var xmlDocument = xmlNode.ownerDocument;

		if (! xmlDocument)
		{
			xmlDocument = xmlNode;
		}

		try
		{
			searchedNodes = xmlDocument.evaluate(xPath, xmlNode, xmlDocument.namespacesResolver(), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
			// debugger; // commented out by Peat for testing in Safari - Jan. 9, 08
			searchedNodes.nextNode = searchedNodes.iterateNext;
		}
		catch (e)
		{
			alert("Exception occurred when finding XPath " + xPath);
		}
	}

	return searchedNodes;
}

XMLHelper.addSelectionNameSpace = function(doc, prefix, namespace)
{
	if (window.isIE) return;

	doc.addSelectionNameSpace(prefix, namespace);
}

// function gets a nodes with xpath.
XMLHelper.selectSingleNode = function(xmlNode, xPath)
{
var bcpxPath=xPath;
	if (! (xmlNode && xPath))
	{
		return;
	}

	var searchedNode = null;

	if (/^[A-Za-z0-9_:]+$/.test(xPath))
	{
		var colonIndex = xPath.indexOf(":");

		if (colonIndex > 0)
		{
			if (window.isIE)
			{
				searchedNode = xmlNode.getElementsByTagName(xPath);
			}
			else
			{
				xPath = xPath.substring(colonIndex + 1, xPath.length);
				searchedNode = xmlNode.getElementsByTagName(bcpxPath);
			}
		}
		else
		{
			searchedNode = xmlNode.getElementsByTagName(xPath);
		}
		return searchedNode[0];
	}

	if (window.isIE)
	{
		searchedNode = xmlNode.selectSingleNode(xPath);
	}
	else
	{
	
		var xmlDocument = xmlNode.ownerDocument;

		if (! xmlDocument)
		{
			xmlDocument = xmlNode;
		}

		try
		{
			var xpathResult =
				xmlDocument.evaluate(xPath, xmlNode, xmlDocument.namespacesResolver(), XPathResult.FIRST_ORDERED_NODE_TYPE, null);
			searchedNode = xpathResult.singleNodeValue;
		}
		catch (e)
		{
			alert("Exception occurred when finding XPath " + xPath);
		}
	}

	return searchedNode;
}

XMLHelper.appendChild = function(destination, source)
{
	if (! (destination && source)) return;

	if (window.isSafari)
	{
		if (destination.ownerDocument != source.ownerDocument)
		{
			// TODO - Also remove the node from the original doc
			source = destination.ownerDocument.importNode(source, true);
		//source.parentNode.removeChild(source);
		}
	}

	destination.appendChild(source);

	return source;
}

XMLHelper.insertBefore = function(destination, source, reference)
{
	if (! (destination && source)) return;

	if (window.isSafari)
	{
		if (destination.ownerDocument != source.ownerDocument)
		{
			// TODO - Also remove the node from the original doc
			source = destination.ownerDocument.importNode(source, true);
		//source.parentNode.removeChild(source)
		}
	}

	destination.insertBefore(source, reference);

	return source;
}

XMLHelper.convertToString = function(xmlNode)
{
	var xml = "";

	if (xmlNode)
	{
		if (window.isIE)
		{
			xml = xmlNode.xml;
		}
		else
		{
			xml = new XMLSerializer().serializeToString(xmlNode);
		}
	}
	return xml;
}

// redirects the page to another URL
function loadURL(url, processid)
{
	if (! url) return;
	window.document.frames.content.location.replace(url);
}

// normalizes a value - removes spaces before and after it
function trim(s)
{
	s = s.replace(/(^\s*)|(\s*$)/gi,"");
	s = s.replace(/[ ]{2,}/gi," ");
	s = s.replace(/\n /,"\n");
	return s;
	//return value.replace(/^\s+/, "").replace(/\s+$/, "");
}

function SSO()
{
}

//validate the login credentials
SSO.authenticate = function(userName, password)
{
	//var samlRequest = SSO._createSamlRequest(true);
	var samlRequest = system.XMLHelper.getXMLDocument(GET_AUTH_DOC);
	Session.User.id = userName;
	// get assertions from the SSO service
	//XMLHelper.setNodeText(samlRequest, "saml:NameIdentifier", "cointuser");
	//XMLHelper.setNodeText(samlRequest, "wsse:Username", "cointuser");
	//XMLHelper.setNodeText(samlRequest, "wsse:Password", "vg1234$");
	var samlResponse = send(samlRequest);
	return SSO.onResponseHandler(samlResponse);
}

var GET_AUTH_DOC = [
'<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">',
'    <SOAP:Header>',
'        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">',
'            <wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">',
'                <wsse:Username>cointuser</wsse:Username>',
'                <wsse:Password>vg1234$</wsse:Password>',
'            </wsse:UsernameToken>',
'        </wsse:Security>',
'    </SOAP:Header>',
'    <SOAP:Body>',
'        <samlp:Request IssueInstant="2004-12-05T09:21:59Z" MajorVersion="1" MinorVersion="1" RequestID="456789" xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol">',
'            <samlp:AuthenticationQuery>',
'                <saml:Subject xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">',
'                    <saml:NameIdentifier Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">cointuser</saml:NameIdentifier>',
'                </saml:Subject>',
'            </samlp:AuthenticationQuery>',
'        </samlp:Request>',
'    </SOAP:Body>',
'</SOAP:Envelope>'
].join('');
// handler getting the assertions from the SSO backend.
SSO.onResponseHandler = function(samlResponse)
{
	var soapFaultNode = XMLHelper.selectSingleNode(samlResponse, "SOAP:Fault");

	if (soapFaultNode)
	{
		SSO.error = new Object();
		SSO.error.xml = soapFaultNode;
		SSO.error.faultString = XMLHelper.getNodeText(soapFaultNode, "faultstring", "");
		SSO.loggedIn = false;
	}
	else
	{
		XMLHelper.addSelectionNameSpace(samlResponse, "wsse",
			"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
		XMLHelper.addSelectionNameSpace(samlResponse, "saml", "urn:oasis:names:tc:SAML:1.0:assertion");
		SSO.handleAssertions(samlResponse);
		
		// let us refresh the assertions
		window.setInterval(SSO._refreshAssertions, 1100000);

		SSO.loggedIn = true;

		return true;
	}
}

// Store newly received assertions, if any
SSO.handleAssertions = function(xml)
{
	var assertions = XMLHelper.selectSingleNode(xml, "saml:Assertion");
	if (assertions != null) SSO.setAssertions(assertions.parentNode); // parentNode contains assertions and its sibling the signature
}

// Save the given assertions
SSO.setAssertions = function(xmlAssertion)
{
	if (xmlAssertion)
	{
		SSO.xmlSavedAssertion = xmlAssertion;
		myAscertion=xmlAssertion;
	}
}

// Clear the SSO Assertions
SSO.clearAssertions = function(xmlAssertion)
{
	SSO.xmlSavedAssertion = null;
}


// add the saved assertions to the header of the request
SSO.addAssertions = function(request)
{
	// if the sso is not used, there are no assertions, nothing to do
	if (! myAscertion)
	{
		return false;
	}


	// create the structure for assertions
	var headerNode = XMLHelper.selectSingleNode(request, "SOAP:Header");
	
	if (! headerNode)
	{
		headerNode = request.createElement("SOAP:Header");
		var envelopeNode = XMLHelper.selectSingleNode(request, "SOAP:Envelope");

		if (! envelopeNode) return false;

		XMLHelper.insertBefore(envelopeNode, headerNode, envelopeNode.firstChild);
	}
	XMLHelper.addSelectionNameSpace(request, "wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
	var securityNode = XMLHelper.selectSingleNode(headerNode, "wsse:Security");

	if (securityNode != null)
	{
		var usernameTokenNode = XMLHelper.selectSingleNode(securityNode, "wsse:UsernameToken");

		if (usernameTokenNode == null)
		{
			headerNode.removeChild(securityNode);
			securityNode = null;
		}
	}
	// add new assertions
	if (securityNode == null)
	{
		// The below line does not work because of a bug in Safari
		//securityNode =  XMLHelper.createElementIfNotExists(request.firstChild, "wsse:Security", null, "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
		var securityDocument = XMLHelper.getXMLDocument(SECURITY_DOCUMENT);
		securityNode = XMLHelper.insertBefore(headerNode, securityDocument.documentElement, headerNode.firstChild);
	}
	XMLHelper.appendChild(securityNode, XMLHelper.selectSingleNode(SSO.xmlSavedAssertion, "saml:Assertion").cloneNode(true));
	XMLHelper.appendChild(securityNode, XMLHelper.selectSingleNode(SSO.xmlSavedAssertion, "Signature").cloneNode(true));

	return true;
}

// Use the still valid assertions to request new assertions. This way the assertions don't time out because of the limited validity time.
SSO._refreshAssertions = function()
{
	var xmlAssertions = SSO.xmlSavedAssertion;
	
	if (Session.User.id  != "")	// refresh assertions only when logged in.
	{
		var request = system.XMLHelper.getXMLDocument(GET_AUTH_DOC); // SSO._createSamlRequest(false); // false means no wsse node because we add our assertions
		XMLHelper.setNodeText(request, "saml:NameIdentifier", Session.User.id);
		SSO.addAssertions(request);
		var response = send(request);
		var faultString = XMLHelper.getNodeText(response, "faultstring", "");
		if (! faultString)
		{
			SSO.handleAssertions(response);
		}
	}
}

SAML_REQUEST =
['<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">',
	'<SOAP:Header>',
		'<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">',
		'</wsse:Security>',
	'</SOAP:Header>',
	'<SOAP:Body>',
		'<samlp:Request xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" MajorVersion="1" MinorVersion="1" IssueInstant="2004-12-05T09:21:59Z" RequestID="456789">',
			'<samlp:AuthenticationQuery>',
				'<saml:Subject xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">',
				'<saml:NameIdentifier Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"></saml:NameIdentifier>',
				'</saml:Subject>',
			'</samlp:AuthenticationQuery>',
		'</samlp:Request>',
	'</SOAP:Body>',
'</SOAP:Envelope>'].join('');

USERNAMETOKEN_DOCUMENT =
['<wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">',
	'<wsse:Username></wsse:Username>',
	'<wsse:Password></wsse:Password>',
'</wsse:UsernameToken>'].join('');

SECURITY_DOCUMENT =
['<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">',
'</wsse:Security>'].join('');

SSO._createSamlRequest = function(includeWsseUsernameToken)
{
	var samlRequestDocument = XMLHelper.getXMLDocument(SAML_REQUEST);
	XMLHelper.addSelectionNameSpace(samlRequestDocument, "wsse",
		"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
	XMLHelper.addSelectionNameSpace(samlRequestDocument, "saml", "urn:oasis:names:tc:SAML:1.0:assertion");

	// set RequestID
	XMLHelper.setAttribute(samlRequestDocument, "Request", "RequestID", SSO._createRequestID());

	// set IssueInstant
	XMLHelper.setAttribute(samlRequestDocument, "Request", "IssueInstant", _getUTCDate());

	if (includeWsseUsernameToken)
	{
		// set userNameToken
		var securityNode = XMLHelper.selectSingleNode(samlRequestDocument, "wsse:Security");
		userNameTokenDoc = XMLHelper.getXMLDocument(USERNAMETOKEN_DOCUMENT);
		XMLHelper.appendChild(securityNode, userNameTokenDoc.documentElement);
	}
	alert("from _createSAMLRequest method====>"+ XMLHelper.convertToString(samlRequestDocument));
	return samlRequestDocument;
}

// creates a (rather) unique ID
SSO._createRequestID = function()
{
	var g = "a"; // XML validation requires that the request ID does not start with a number

	for (var i = 0; i < 32; i++)
	{
		g += Math.floor(Math.random() * 0xF).toString(0xF) + (i == 8 || i == 12 || i == 16 || i == 20 ? "-" : "")
	}
	return g;
}

// Get an UTC date in this format: 2004-12-05T09:21:59Z"
function _getUTCDate()
{
	var oDate = new Date();

	// handle date part
	var dateSep = "-";
	var day = oDate.getDate();
	var month = oDate.getMonth() + 1;
	var sDay = (day < 10) ? '0' + day : day;
	var sMonth = (month < 10) ? '0' + month : month;
	var sValue = oDate.getFullYear() + dateSep + sMonth + dateSep + sDay + "T";

	// handle time part
	var timeSep = ":";
	var hours = oDate.getHours();
	var minutes = oDate.getMinutes();
	var seconds = oDate.getSeconds();
	var sHours = (hours < 10) ? '0' + hours : hours;
	var sMinutes = (minutes < 10) ? '0' + minutes : minutes;
	var sSeconds = (seconds < 10) ? '0' + seconds : seconds;
	sValue += sHours + timeSep + sMinutes + timeSep + sSeconds + "Z";

	return sValue;
}

Session = {}
Session.User = {}
Session.Advisor = {}


var MESSAGES = { 
"HTTP_ERROR"					: "Error occurred in contacting the server. Please try again.",
"SOAP_ERROR"					: "Error occurred on the server while processing the request",
"REGISTRATION_FAULT_HEADER"		: "Registration Error",
"QUESTIONREGISTER_FAULT_HEADER"	: "Question Submission Error",
"TAXTOPICS_FAULT_HEADER"		: "Could not retreive Tax Topics",
"QUESTIONS_FAULT_HEADER"		: "Failed in retreiving Questions",
"QUESTION_FAULT_HEADER"			: "Failed in retrieving Question Details",
"QUESTIONSAVE_FAULT_HEADER"		: "Failed in saving Question",
"QUESTIONSEND_FAULT_HEADER"		: "Failed in sending Question",
"QUESTION_NOT_FOUND"			: "Question not Found",
"PAYMENT_FAULT_HEADER"			: "Payment Failed",
"LOSTPASSWORD_FAULT_HEADER"		: "Failed in sending password",
"CHANGEPASSWORD_FAULT_HEADER"		: "Failed in changing password",
"FEEDBACK_FAULT_HEADER"			: "Error occurred in Sending Feedback",
"PROFILE_FAULT_HEADER"			: "Error occurred in Retrieving Profile",
"PROFILESAVE_FAULT_HEADER"		: "Error in Saving Profile",
"ATTACHMENT_FAULT_HEADER"		: "Failed in retrieving Attachment Details",
"DOWNLOAD_FAULT_HEADER"			: "Error Occurred in Downloading Document",
"ACCEPT_FAULT_HEADER"			: "Failed in accepting Question",
"REJECT_FAULT_HEADER"			: "Failed in rejecting Question" };

