// JavaScript Document
var t1 = "";
var t2 = "";

function closeDialogCustom()
{
	document.body.removeChild(byId("newtaskcontainerxxx"));
	document.body.removeChild(byId("newtaskwindowxxx"));
}
function closeDialog()
{
	document.body.removeChild(byId("newtaskcontainer"));
	document.body.removeChild(byId("newtaskwindow"));
}
function closeDialogue()
{
	closeDialog();
}
function showDialogCustom(data,title,containerclass,innerclass)
{
	if(!title){ title = ""; }
	var pw = document.createElement("div");
	var cont = document.createElement("div");
	cont.id = "newtaskcontainerxxx";
	pw.id = "newtaskwindowxxx";
	cont.innerHTML = "z";
	document.body.appendChild(cont);
	cont.className = containerclass;
	pw.className = innerclass;
	document.body.appendChild(pw);
	var innerst = "<table width ='100%'><tr><td><b><small>"+title+"</small></b></td><td align='right'><a class='close' href='javascript:closeDialogCustom();'>[close]</a></td></tr><tr><td colspan='2'>"+data+"</td></tr></table>";
	pw.innerHTML = innerst;
	
}
function showDialog(data,title)
{
	if(!title){ title = ""; }
	var pw = document.createElement("div");
	var cont = document.createElement("div");
	cont.id = "newtaskcontainer";
	pw.id = "newtaskwindow";
	cont.innerHTML = "z";
	document.body.appendChild(cont);
	cont.className = "newtaskcontainer";
	document.body.appendChild(pw);
	var innerst = "<table width ='100%'><tr><td><b><small>"+title+"</small></b></td><td align='right'><a class='close' href='javascript:closeDialog();'>[close]</a></td></tr><tr><td colspan='2'>"+data+"</td></tr></table>";
	pw.innerHTML = innerst;
	
}
function showDialogue(data,title)
{
	showDialog(data,title);
}

function showDialogCon(data,title)
{
	if(!title){ title = ""; }
	var pw = document.createElement("div");
	var cont = document.createElement("div");
	cont.id = "newtaskcontainer";
	pw.id = "newtaskwindow";
	cont.innerHTML = "z";
	document.body.appendChild(cont);
	cont.className = "newtaskcontainer";
	document.body.appendChild(pw);
	var innerst = "<table width ='100%'><tr><td><b><small>"+title+"</small></b></td><td align='right'><a class='close' href='javascript:closeDialog();'>[close]</a></td></tr><tr><td colspan='2'>"+data+"</td></tr></table>";
	pw.innerHTML = innerst;
	return true;
}

function byId(id, doc)
{
		if (id && (typeof id == "string" || id instanceof String)) 
		{ 
			if (!doc) 
			{ 
				doc = document; 
			} 
			return doc.getElementById(id); 
		} 
		return id;
}

function jax(args)
{
	//var mime = args["type"];
	var method = args["method"];
	var content = args["content"];
	var url = args["url"];
	//var load = 
	var contentType = "";
	if(method.toString() == "POST")
	{
		contentType = "application/x-www-form-urlencoded; charset=UTF-8";	
	}else
	{
		contentType = "text/plain";
	}
	
	
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	  
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	 
	 xmlhttp.onreadystatechange = function()
			{
				if(xmlhttp.readystate == 4)
				{
					if(xmlhttp.status > 100 && xmlhttp.status < 300)
					{
							args.load(xmlhttp.responseText);
					}else{
						if(xmlhttp.status > 400 && xmlhttp.status < 600)
						{
								args.error("An error occured. Please contact Inhouse Business Solutions.<br>Details: "+xmlhttp.status+" \n "+xmlhttp.statusText);
						}
					}
					
				}
			}
			
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
			xmlhttp.onload = function(){						
				args.load(xmlhttp.responseText);
			};
	xmlhttp.onerror = function(){
				args.error("An error occured. Please contact Inhouse Business Solutions.<br>Details: "+xmlhttp.statusText);
			};
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
			xmlhttp.onload = function(){						
				args.load(xmlhttp.responseText);
			};
	xmlhttp.onerror = function(){
				args.error("An error occured. Please contact Inhouse Business Solutions.<br>Details: "+xmlhttp.statusText);
			};
		} catch (e) {
			xmlhttp=false;
		}
	}
	
	var contentStr = ""
	t2 = xmlhttp;
	for(var i in content)
	{
		if(contentStr != ""){ contentStr +="&";}
		contentStr += ""+i+"="+escape(content[i])+"";	
	}
	
	
	xmlhttp.open(method,url,true);
	xmlhttp.setRequestHeader("Content-Type", contentType);
	xmlhttp.send(contentStr);
	t1 = contentStr;
	

}

function isIE()
{
	
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer")
	{
		return true;	
	}else
	{
		return false;
	}	
	
}	
