window.isSystem = true;

var BASEGATEWAYURL = "cordys/com.eibus.web.soap.Gateway.wcp?organization=o%3DTataMotors%2Ccn%3Dcordys%2Co%3Dtatamotors.com&amp;messageOptions=0";

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;


// lowest level send Protocol. Deals only with HTTP Errors. Do not use directly
function sendHttpRequest(request, url)
{
		 // let us add assertions
		 SSO.addAssertions(request);

		 var xmlhttpObject = null;

		 if (window.isIE)
		 {
		 		 xmlhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
		 }
		 else
		 {
		 		 xmlhttpObject = new XMLHttpRequest();
		 }

		 if (! xmlhttpObject)
		 {
		 		 return alert("Creation of XMLHttpObject Failed.");
		 }

		 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);
}

// 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;
		 }

		 //}
}

// Begin

function expandingWindow(website) {
var
windowprops='width=100,height=100,scrollbars=yes,status=yes,resizable=yes'
var heightspeed = 5; // vertical scrolling speed (higher = slower)
var widthspeed = 7;  // horizontal scrolling speed (higher = slower)
var leftdist = 10;    // distance to left edge of window
var topdist = 10;     // distance to top edge of window

if (window.resizeTo&&navigator.userAgent.indexOf("Opera")==-1) {
var winwidth = window.screen.availWidth - leftdist;
var winheight = window.screen.availHeight - topdist;
var sizer = window.open("","","left=" + leftdist + ",top=" + topdist
+","+ windowprops);
for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed)
sizer.resizeTo("1", sizeheight);
for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed)
sizer.resizeTo(sizewidth, sizeheight);
sizer.location = website;
}
else
window.open(website,'mywindow');
}
//  End -->