// JavaScript Document

var xmlhttp;
			
			function callService(method,fields,debug)
			{	
				xmlhttp = null;				
				
				if (window.XMLHttpRequest)
				{
					// code for Mozilla, etc.
					xmlhttp = new XMLHttpRequest();
				}
				
				else if (window.ActiveXObject)
				{
					// code for IE
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				
				if (xmlhttp != null)
				{
					var url = "/services/?method=netrunneronline.";
						url += method;						
				
					if(!!fields)
					{
						for(i in fields)
						{
							url += "&" + i + "=" + fields[i];
						}
					}
					
					if(!!debug)
					{
						alert(url);	
						
						for(i in fields)
						{
							alert(i + "=" + fields[i]);
						}
						
					}
					xmlhttp.onreadystatechange = onSuccess;							
					xmlhttp.open("GET",url,true);
					xmlhttp.send(null);
				}
				else
				{
					alert("Sorry, your browser does not AJAX support operations.");
				}						
			}
			
			
			function onSuccess()
			{						
				if(xmlhttp.readyState==4)
				{
					//loaded									
					if(xmlhttp.status == 200)
					{
						onLoad(xmlhttp.responseText);
						//OK							
					}else{
						//error
						alert("There was an error adding the card to your collection.");										
					}
				}
			}
			