///////////////////////////////////////////////////////////////
//                                                           //
// Sprite Ctrl JavaScript Version 1.6.1.0 - 20031120         //
//                                                           //
//                                 Programming By Lance Moon //
//                                                           //
///////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////
// Global Variable

//var g_ActiveX = null;
//var g_AvatarNodes = null;
//var g_CurrentAvatarID = -1;


///////////////////////////////////////////////////////////////
// JS - Javascript related function

// XMLHTTP

/*@cc_on @*/
/*@if (@_jscript_version >= 5)

	// JScript gives us Conditional compilation, we can cope with old IE versions.
	try
	{
		g_XMLHttp=new ActiveXObject("Msxml2.XMLHTTP")
	}
	catch (e)
	{
		try
		{
			g_XMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		catch (E)
		{
			JS_Message("You must have Microsoft XML parsers available")
		}
	}
	
@else

	JS_Message("You must have JScript version 5 or above.")
	g_XMLHttp=false
	alerted=true
	
@end @*/

var g_XMLHttp, alerted, beatdancer_login;	


if( !g_XMLHttp && !alerted ){
	// Non ECMAScript Ed. 3 will error here (IE<5 ok), nothing I can 
	// realistically do about it, blame the w3c or ECMA for not
	// having a working versioning capability in  <SCRIPT> or ECMAScript.
	try	{
		g_XMLHttp = new XMLHttpRequest();
	}catch( e ){
		alert( "You need a browser which supports an XMLHttpRequest Object.\nMozilla build 0.9.5 has this Object and IE5 and above" );
	}
}

function JS_Replace(string,text,by)
{
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
    newstr += JS_Replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}



function JS_ParseXML( xmlstring ){
	/// XMLDOM ¿ÀºêÁ§Æ® ¼ÂÆÃ
	var g_XMLDom = new ActiveXObject('Microsoft.XMLDOM');
	g_XMLDom.async = false;
	g_XMLDom.resolveExternals = false;
	
	xmlstring = JS_Replace( xmlstring, "& ","&amp; ");
	
	//alert(xmlstring);
	
	///xml °á°ú°ª
	if( g_XMLDom.loadXML( xmlstring ) )	{
		return g_XMLDom.documentElement;
	}else{
		alert( "Failed To Parse XML String - " + xmlstring );
	}
}



