function serializeObject(objInst)	
{
	var sXML = "<object>";
	
	for ( i in objInst ) 
	{
		sXML += "<" + i + ">" + objInst[i] + "</" + i + ">";
	}
	sXML += "<object>";

	return sXML;
}

function xmlToSetting(xmlString) {
//alert("xmlToSetting=" + xmlString) ;
	var xmlDoc = new ActiveXObject("MSXML.DOMDocument");
	xmlDoc.async = false;
	xmlDoc.resolveExternals = false;
	var isLoaded = xmlDoc.loadXML(xmlString) ;
	var settings = null ;
	var root;
	var key = "" ;
	var value = "";
	if (isLoaded) {
		root = xmlDoc.documentElement;
		for (var i=0; i<root.childNodes.length; i++) {
			key = root.childNodes.item(i).nodeName;
  			value = root.childNodes.item(i).childNodes.item(0).text;
			if (settings==null) {
				settings = "" ;
			} else {
				settings += " " ;
			}
			settings += key + " '" + value + "'" 
		}		
	}
	
	return settings ;
}

function settingToXML(settings)
{
//alert("settingToXML=" + settings) ;
	var xmlString = "<pogosetting>" ;
	var tmpArray = new Array();
	tmpArray = settings.split(' ');
	
	for(var i = 0; i < tmpArray.length; i += 2)
	{
		if(tmpArray[i] && tmpArray[i+1])
		{
			var matchRes = tmpArray[i+1].match(/(['"])[^'"]*\1/);
			var matchVar = null;

			if(matchRes != null)
				matchVar = tmpArray[i+1].substring(matchRes['index']+1,matchRes['lastIndex']-1);

			xmlString += "<" + tmpArray[i] + ">" + matchVar + "</" + tmpArray[i] + ">" ; 
		}
	}
	
	xmlString += "</pogosetting>" ;	
	
	tmpArray.length = 0 ;
	return xmlString;
}

function isTrue(txt) {
	if (txt && txt.toLowerCase()=="true") {
		return true ;
	} else {
		return false ;
	}
}


function trim(str) {
	var i = 0 ;
	var j = 0 ;
	var k = 0 ;
	for(i = 0; str.charCodeAt(i) == 32; i++);
	for(j = str.length-1; str.charCodeAt(j) == 32; j--);
	if (j<i) {
		k=i ;
	} else {
		k=j+1 ;
	}
	return str.substring(i, k);
}



function getRegCode()
{
	easoMain.SetVariable("/mcContent1:RegKey",Media.GetRegistryValue(2,main.gblRegistryKey, ""));
}
