// JavaScript Document
var PhoneType;
var dom = (document.getElementById) ? true : false;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ns4 = (document.PopUps && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;

function GetDocObject(Doc, Obj, Level)
{
	var objref;
	
	if (dom)
		objref = Doc.getElementById(Obj);
	else if (ie4)
		objref = Doc.all[Obj];
	else if (ns4)
		objref = Doc.layers[Obj];

	if (Level == "style")
		if (objref.style)
			return objref.style;
		else
			return objref;
	else
		return objref;
}

function ShowDemoPage(Loc)
{
	PhoneType = Loc;

	parent.HomeWelcome.location.replace("phonedemo.htm");
}

// This function will return the value of a GET parameter
function getParam(paramName)
{
	var ret;
	var arg;
	var arg_values;
    var paramStr = document.location.search;

	if (paramStr == "")
      return "";

    // remove '?' in front of paramStr
    if (paramStr.charAt(0) == "?")
        paramStr = paramStr.substring(1, paramStr.length);

    arg = (paramStr.split("&"));

	for (i=0; i < arg.length; i++) {
        arg_values = arg[i].split("=")
        if (unescape(arg_values[0]) == paramName)
		{
        	if (self.decodeURIComponent) // check if decodeURIComponent() is defined
                ret = decodeURIComponent(arg_values[1]);
            else
                ret = unescape(arg_values[1]);  // IE 5.0 and older does not have decodeURI
            return ret;
        }
    }
    return "";
}

function trim(text)
{
	//trim the leading spaces
	while('' + text.charAt(0) == ' ')
		text = text.substring(1, text.length);
		
		
	//trim the trailing spaces
	while('' + text.charAt(text.length - 1) == ' ')
		text = text.substring(0, text.length - 1);
		
	return text;
}

