
///////end generic code

//////////////////////

/**
 * This function ascertains the outcome of the request to the login servlet. If
 * the result XML will be in the form:
 *   <result>
 *     <login>[REJECTED | DIRECT_ACCESS | OK]</login>
 *   </result>
 */
function myFunction(request) {

	var respRoot = request.responseXML.documentElement;

	for ( var j = 0; j<=6; j++ ) {

		if ( (respRoot.childNodes[j] != null ) && (respRoot.childNodes[j].tagName == "result") ) {
			document.getElementById("photourl" + j).innerHTML =
		 		"<a href=\"/" + compdirectory + complang + "/vote.html?viewraceface=" + respRoot.childNodes[j].childNodes[0].firstChild.nodeValue + "\"><img src=\"" + respRoot.childNodes[j].childNodes[2].firstChild.nodeValue + "\" border=\"0\" height=\"80\" width=\"80\"></a>";

		} else {
			//alert ("tag name was not 'result'...it's: " + respRoot.childNodes[0].tagName);
		}

	}
}

function printChildNodeNames(element) {

	var buffer = "Child Names: ";

	for (var i=0; i < element.childNodes.length; i++) {
		buffer += element.childNodes[i].nodeName + ",";
	}

	//alert (buffer);

}

//////////////////////

function login () {

	var url = "/soegamesite/photocomp/topfive.xml";

	new ajax (url, {onComplete:myFunction});
}



//var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
function loadXML(xmlFile)
{
 xmlDoc.async="false";
 xmlDoc.onreadystatechange=verify;
 xmlDoc.load(xmlFile);
 xmlObj=xmlDoc.documentElement;
}

function verify()
{
 // 0 Object is not initialized
 // 1 Loading object is loading data
 // 2 Loaded object has loaded data
 // 3 Data from object can be worked with
 // 4 Object completely initialized
 if (xmlDoc.readyState != 4)
 {
   return false;
 }
}

//loadXML('http://localhost:8080/en/score.xml');

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=353,height=278,left = 390,top = 162');");
}
