 
var isdrag=false;
var x,y;
var dobj;

var ie=document.all;
var firefox=false;
var chrome=false;
var safari=false;
var nn6=document.getElementById&&!document.all;
var nn6off = nn6 ? 2 : 0;

var base64 = {

    // private property
    _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

    // public method for encoding
    encode : function (input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;

        input = base64._utf8_encode(input);

        while (i < input.length) {

            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);

            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;

            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            } else if (isNaN(chr3)) {
                enc4 = 64;
            }

            output = output +
            this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
            this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

        }

        return output;
    },

    // public method for decoding
    decode : function (input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;

        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

        while (i < input.length) {

            enc1 = this._keyStr.indexOf(input.charAt(i++));
            enc2 = this._keyStr.indexOf(input.charAt(i++));
            enc3 = this._keyStr.indexOf(input.charAt(i++));
            enc4 = this._keyStr.indexOf(input.charAt(i++));

            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;

            output = output + String.fromCharCode(chr1);

            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }

        }

        output = base64._utf8_decode(output);

        return output;

    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}

function goTop()
{
	if($('topme')!=null)
		$('topme').innerHTML="<input type='text' id='inpt_topme' name='inpt_topme' style='width:1px; height:1px; border:0px; margin:0px; padding:0px;'/>";
	if($('inpt_topme')!=null)
		$('inpt_topme').focus();
	if($('topme')!=null)
		$('topme').innerHTML="";
}



// retorna o objeto do DOM com id = s
function $( s ) { return document.getElementById( s ); }

// cria um elemento do tipo t
function ce( t ) { return document.createElement( t ); }

// funcao vazia
function v(){};

// Insere node logo apos o elemento referenceNote
function insertAfter(node, referenceNode)
{
  referenceNode.parentNode.insertBefore(node, referenceNode.nextSibling);
}

// retorna se alguma variavel foi definida
function isdefined( variable)
{
    return (typeof(variable) == "undefined")?  false: true;
}

function isfunction(variable)
{
    return (typeof(variable) == "function")?  true: false;
}

// retorna se variavel é um número
function isnumber( variable)
{
    return (typeof(variable) == "number")?  false: true;
}

// retorna o valor de uma string. zero se nao for um numero
function val( o )
{
	var vo = o*1;
	return vo+'' == 'NaN' ? 0 : vo;
}

// sprintf
function sprintf()
{
   if (!arguments || arguments.length < 1 || !RegExp)
   {
      return;
   }
   var str = arguments[0];
   var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
   var a = b = [], numSubstitutions = 0, numMatches = 0;
   while (a = re.exec(str))
   {
      var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
      var pPrecision = a[5], pType = a[6], rightPart = a[7];

      numMatches++;
      if (pType == '%')
      {
         subst = '%';
      }
      else
      {
         numSubstitutions++;
         if (numSubstitutions >= arguments.length)
         {
            alert('Error! Not enough function arguments (' + (arguments.length - 1)
               + ', excluding the string)\n'
               + 'for the number of substitution parameters in string ('
               + numSubstitutions + ' so far).');
         }
         var param = arguments[numSubstitutions];
         var pad = '';
                if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
           else if (pPad) pad = pPad;
         var justifyRight = true;
                if (pJustify && pJustify === "-") justifyRight = false;
         var minLength = -1;
                if (pMinLength) minLength = parseInt(pMinLength);
         var precision = -1;
                if (pPrecision && pType == 'f')
                   precision = parseInt(pPrecision.substring(1));
         var subst = param;
         switch (pType)
         {
         case 'b':
            subst = parseInt(param).toString(2);
            break;
         case 'c':
            subst = String.fromCharCode(parseInt(param));
            break;
         case 'd':
            subst = parseInt(param) ? parseInt(param) : 0;
            break;
         case 'u':
            subst = Math.abs(param);
            break;
         case 'f':
			if( precision > -1 )
			 {
				subst = Math.round(parseFloat(param) * Math.pow(10, precision)) + '';
				if( subst == '0' )	for( var i = 0 ; i < precision ; i++ ) subst += '0'; 
				subst  = subst.substr( 0, subst.length-2 ) + '.' + subst.substr( subst.length-2, 1000 );
			 }
			 else
				 subst = parseFloat(param);
            break;
         case 'o':
            subst = parseInt(param).toString(8);
            break;
         case 's':
            subst = param;
            break;
         case 'x':
            subst = ('' + parseInt(param).toString(16)).toLowerCase();
            break;
         case 'X':
            subst = ('' + parseInt(param).toString(16)).toUpperCase();
            break;
         }
         var padLeft = minLength - subst.toString().length;
         if (padLeft > 0)
         {
            var arrTmp = new Array(padLeft+1);
            var padding = arrTmp.join(pad?pad:" ");
         }
         else
         {
            var padding = "";
         }
      }
      str = leftpart + padding + subst + rightPart;
   }
   return str;
}


// funcao de debug. Retorna em uma nova janela todas as variaveis e sub objetos de um objeto
function inspect( dobj )
{
	win = window.open( '', 'inspectwindow' );
	for (var i in dobj)	
	{ 
		var j = eval( 'dobj.' + i );
		win.document.write( i + ', ' + typeof( j )+ ', ' +  j + '<br>' );
//		debug( i, typeof( j ), j );
	}
}

// fecha div de debug
function debugclose()
{
	var debugid = '_debug_log';
	var _log = $(debugid);
	_log.parentNode.removeChild( _log );
	_log = null;
}

// escreve um debug em um div flutuante na tela
function debug()
{
	var i;
	var list = [];

	var debugid = '_debug_log';
	if( $(debugid) == null )
	{
		log = ce( 'div' );
		log.id = debugid;
		log.className = 'debug';
		log.innerHTML = '<nobr><b>Debug Window</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:debugclose()">close</a></nobr>';
		document.body.appendChild( log );
	}

	for( i = 0 ; i < arguments.length ; i++ )
	{
		list[i] = arguments[i];
	}
	$(debugid).innerHTML += '<br>' + list.join( ', ' );
	$(debugid).style.zIndex = 1000000;
	$(debugid).style.top = document.body.scrollTop + 10;
}


function png( src, w, h, s )
{
	if( nn6 )
		return '<img src="' + src + '" width=' + w + ' height=' + h + ' border=0 alt="" style="' + s + '">';
	else
		return '<div style="' + s + ';width:' + w + ';height:' + h + ";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')" + '"></div>';
}


// janela do popup
var popupwin = null;

// resultado ajax do conteudo do popup
function popupresult( txt, obj )
{
	var pop = popupwin;
	var st, sb;
	var i;

	if ( pop == null ) return;
	resultform( txt, obj );
	popupresize();
	var imglist = obj.getElementsByTagName("IMG");
	for( i = 0 ; i < imglist.length ; i++ )
	{
		if( isdefined( imglist[i].onload ) && imglist[i].onload != null )
		{
			imglist[i].onload2 = imglist[i].onload;
			imglist[i].onload = function() { this.onload2(); this.style.display = 'block'; popupresize(); };
		}
		else
			imglist[i].onload = function() { this.style.display = 'block'; popupresize(); };
	}
	st = pop.offsetTop - document.body.scrollTop;
	sb =  (document.body.scrollTop+document.body.clientHeight) - (pop.offsetTop + pop.clientHeight);
//	if( st < 0 ) scrollBy( 0, st-10 );
//	else if( sb < 0 ) scrollBy( 0, -sb + 10 );
}

// verifica o tamanho e posicao que popup deve ocupar de acordo com seu tamanho interno
function popupresize()
{
	var pop = popupwin;
	var vtop;
	if( pop == null ) return;
	//# - checking for object existence - added by jeyaseelan
	if($('popupshadow'))
	{
		$('popupshadow').style.height = $('popupbackground').style.height = pop.clientHeight; 
		$('popupshadow').style.width = $('popupbackground').style.width = pop.clientWidth;
		if( ie )
		{
			$('popupshadow').style.top = $('popupshadow').style.left = 3;
		}
		if( pop.poshoriz == 'd' )
		{
			pop.style.top = vtop = pop.postop - (pop.clientHeight+pop.posofftop);
			$('popuparrow').style.top = ie ? pop.clientHeight -1 : pop.clientHeight + 1;
		}
		else if( pop.poshoriz == 'u' )
		{
			pop.style.top = vtop = pop.postop + (pop.posofftop);
			$('popuparrow').style.top = ie ? -pop.posofftop + 1 : -pop.posofftop + 1;

		}
		if( vtop < 0 && !pop.forcedisplay )
		{
//			alert( vtop + ', ' + pop.poshoriz );
			pop.forcedisplay = true;
			pop.poshoriz = 'u';
			popupresize();
			$('popuparrow').innerHTML = png( 'tool/' + ctable + '/c_arrow_' + pop.poshoriz + pop.posvert + '.png', 43, 25 );
			return;
		}
		pop.style.left = pop.posvert == 'l' ? pop.posleft : pop.posleft - pop.clientWidth;
		$('popuparrow').style.left = pop.posvert == 'l' ? 0 : pop.clientWidth - pop.posoffleft;
		$('popupclose').style.left = pop.clientWidth - 20;
	}
	// scroll window to fit popup
	if( vtop < document.body.scrollTop )
	{
//		window.scrollBy( 0, vtop-(document.body.scrollTop+4) );
	}
	if( (vtop + pop.clientHeight) > (document.body.scrollTop + document.body.clientHeight) )
	{
//		window.scrollBy( 0, (vtop + pop.clientHeight)-(document.body.scrollTop + document.body.clientHeight - 4) );
	}
}

// get popupcontent from url
function popupgeturl( url )
{
	ajaxrequest( url + '&rnd=' + Math.random(), 'popupresult', $('popupcanvas'), 0 );
}

// abre um popup ancorado em top/left com width. E pega seu conteudo de url
function popup( url, top, left, width )
{
	var pop = ce('div');

	pop.forcedisplay = false;
	nopopup();
	pop.onresize = function() { popupresize() };
	pop.className = 'popup';
	pop.style.width = width;
	pop.postop = top;
	pop.posofftop = 25;
	pop.posoffleft = 43;
	pop.posleft = left;
	pop.poshoriz = top - document.body.scrollTop > document.body.scrollTop + document.body.clientHeight - top ? 'd' : 'u';
	pop.posvert = left > width+50 ? 'r' : 'l';
	pop.innerHTML = '<div id="popuparrow" class=arrow>' + png( 'tool/' + ctable + '/c_arrow_' + pop.poshoriz + pop.posvert + '.png', 43, 25 ) + '</div><div class="shadow" id="popupshadow"></div><div class="back" id="popupbackground"></div><div class="txt" id=popupcanvas><p>' + TXT_LOADING + '</p></div><div id="popupclose" class="dddeletebutton" onclick="nopopup()"></div>';
	popupwin = pop;
	document.body.appendChild( pop );
	$('popupcanvas').onchange = function() { popupresize(); }
	if( url != '' ) ajaxrequest( url + '&rnd=' + Math.random(), 'popupresult', $('popupcanvas'), 0 );
	popupresize();
//	document.body.onmousedown = function() { nopopup(); };
	return pop;
}

// fecha o popup caso esteja visivel
function nopopup()
{
	if( popupwin != null ) document.body.removeChild( popupwin );
	popupwin = null;
//	document.body.onmousedown = null;
}

// retorna a largura máxima utilizavel na janela
function maxwid()
{
	return document.body.clientWidth - 20;
}

var myloc;

// retorna se uma opcao de menu deve ser selecionada, de acordo com a url atual
function navselect( obj )
{
	var i, j;
	var url = vtag( obj, 'url' )

	if( myloc == url ) return true;
	else
	{
		var alturllist = ntag( obj, 'alturl' );
		for( j = 0 ; j < alturllist.length ; j++ )
		{
			var alturl = alturllist[j].firstChild.nodeValue;
			if( eval( 'myloc.match(/' + alturl + '/)' ) ) return true;
		}
	}
	return false;
}


// retorna codigo html de um campo de search generico para componentes diversos
function searchfield( script, id, inival )
{
	var otop = ie ? 0 : -6;
	var ini = isdefined( inival ) ? inival : 'search';
	var id = isdefined( id ) ? 'id="' + id + '"' : '';
	return '<div class=searcharea align=right><form onsubmit="return ' + script + '(this)"><table border=0 cellpadding=0 cellspacing=0><tr><td class=searchlabel>Search:<br><input type="text" name=search '+ id + ' class="searchfield" value="' + ini + '" onfocus="this.select()" style="top: '+otop+'px"></td><td><input type="image" src="tool/' + ctable + '/ok.gif" class=searchok></table></form></div>'
}

// search especial para o browse de produtos
function searchinbrowser( script, id, inival, iniin, inibrand, iniretail)
{
	var inicateg = '';
	var otop = ie ? 0 : -6;
	var ini = isdefined( inival ) ? inival : 'search';
	var id = isdefined( id ) ? 'id="' + id + '"' : '';
	var outtxt = '<div class=searcharea align=right><form onsubmit="return ' + script + '(this)"><table border=0 cellpadding=0 cellspacing=0><tr><td class=searchlabel>Search:<br><input type="text" name=search '+ id + ' class="searchfield" value="' + ini + '" onfocus="this.select()" style="top: '+otop+'px"></td>';

	outtxt += '<td class=searchlabel>Featured Brands:<br><select  load="brand_list.php" width=150 name="srchbrand" class="searchfield" style="top: '+otop+'px">';
	outtxt += '<option value="" ';
	outtxt += inibrand == '' ? 'selected' : '';
	outtxt += '>All Brands</option>';
	outtxt += '</select></td><td class=searchlabel>Retailer:<br><select load="retailer_list.php" width=150 name="srchretail" class="searchfield" style="top: '+otop+'px">';
	outtxt += '<option value="" ';
	outtxt += iniretail == "" ? 'selected' : '';
	outtxt += '>All Retailers</option></select></td>';	
	outtxt += '<td class=searchlabel>Gender:<br><select width=100 load="gender_list.php" name="srchgender" class="searchfield" style="top: '+otop+'px"></select></td>';
	outtxt += '<td class=searchlabel>Category:<br><select load="category_list.php" tree=1 width=200 name="srchcateg" class="searchfield" style="top: '+otop+'px"></select></td><td><input type="image" src="tool/' + ctable + '/ok.gif" class=searchok></table></form></div>';
	return outtxt
}

// search especial para o browse de venues
function searchinvenues( script, id, inival, inicateg)
{
	var otop = ie ? 0 : -6;
	var ini = isdefined( inival ) ? inival : '';
	var categ = isdefined( inicateg ) ? inicateg : '0';
	var id = isdefined( id ) ? 'id="' + id + '"' : '';
	//ini = 'Enter place or area';
	var outtxt = '<div style="margin: 5px;"><form onsubmit="return ' + script + '(this)"><input helper="' + TXT_ENTER_PLACE + '" type="text" name=search '+ id + ' class="inputtext inputsearch box" value="' + ini + '" style="width: 180px;"><input name="" type="submit" class=button value="' + TXT_FIND + '" sstyle="margin-top: 4px"><div class=error id="vbrowsesearcherr" style="display: none"></div>';
	outtxt += '</form></div>';
	return outtxt;
}

// search especial para o browse de venues
function searchinarea( script, id, inival)
{
	var otop = ie ? 0 : -6;
	var ini = isdefined( inival ) ? inival : '';
	var id = isdefined( id ) ? 'id="' + id + '"' : '';
	//ini = 'Enter place or area';
	var outtxt = '<div style="border-bottom: 1px solid #777; margin-bottom: 10px"><br>Type a city and state or zip code to change your area<div style="margin: 5px;"><form onsubmit="return ' + script + '(this)"><input helper="' + TXT_ENTER_CITY + '" type="text" name="search" '+ id + ' class="inputtext inputsearch box" value="' + ini + '" onfocus="this.select()" style="width: 100%; margin-right:10px;"><div class=error id="areabrowsesearcherr" style="display: none"></div>';
	outtxt += '<input name="" type="submit" class=button value="' + TXT_FIND + '" style="margin-top: 4px"> <input name="" type="button" class=button value="' + TXT_CANCEL + '" onclick="document.location = \'home.php?atoken=' + auth_token + '&&mydomain='+appdomain+'\'" style="margin-top: 4px"></form></div></div>';
	return outtxt;
}

// search especial para o browse de venues
function searchinvenues2( script, id, inival, inicateg)
{
	var otop = ie ? 0 : -6;
	var ini = isdefined( inival ) ? inival : '';
	var categ = isdefined( inicateg ) ? inicateg : '0';
	var id = isdefined( id ) ? 'id="' + id + '"' : '';
	//ini = 'Enter place or area';
	var outtxt = '<div style="border-bottom: 1px solid #777; margin-bottom: 10px"><br>Type a business, address and/or intersection  in your area to change your place<div style="margin: 5px;"><form onsubmit="return ' + script + '(this)"><input helper="' + TXT_ENTER_PLACE + '" type="text" name=search '+ id + ' class="inputtext inputsearch box" value="' + ini + '" onfocus="this.select()" style="width: 100%; margin-right:10px;"><div class=error id="vbrowsesearcherr" style="display: none"></div>';
	outtxt += '<input name="" type="submit" class=button value="' + TXT_FIND + '" style="margin-top: 4px"> <input name="" type="button" class=button value="' + TXT_CANCEL + '" onclick="document.location = \'home.php?atoken=' + auth_token + '&&mydomain='+appdomain+'\'" style="margin-top: 4px"></form></div></div>';
	return outtxt;
}

// insert group
function selectingroup( script, id, gid)
{
	//if (!(gid)) gid = 0;
	var outtxt = '<span style="margin: 0px;" id="divsel'+id+'">';
	outtxt += '<form method="GET" id="registerGroup'+id+'" name="regGroup" action="register_groups.php">';
	//outtxt += '<form method="GET" id="registerGroup'+id+'" name="regGroup" action="register_groups.php?type=0&&bcount='+id+'&&atoken='+atoken+'&&gid='+gid+'" oonsubmit="return ' + script + '(this, '+gid+'); return false;">';
	outtxt += '<input type="hidden" name="type" value="0">';
	outtxt += '<input type="hidden" name="bcount" value="'+id+'">';
	outtxt += '<input type="hidden" name="atoken" value="'+auth_token+'">';
	outtxt += '<input type="hidden" name="mydomain" value="'+appdomain+'">';
	outtxt += '<input type="hidden" name="gid" value="'+gid+'">';
	outtxt += '<input type="text" name="gname" helper="' + TXT_ENTER_GROUP + '" style="width: 200px ">';
	//outtxt += '<td valign=middle><input type="text" name="search" helper="group name" style="position: relative; top: -10px; margin-top: 0px; padding: 0px; padding-top: 0px;padding-left: 0px; padding-right: 0px;"></td>'
	if (gid == 0) {
		outtxt += '<input name="" type="submit"  class=button value="' + TXT_ADD + '">';
		outtxt += '<input type="button" onclick="dellgroup('+ id + ');" value="' + TXT_CANCEL + '" class=button>';
	} else {
		outtxt += '<input name="" type="submit"  class=button value="Update">';
		outtxt += '<input type="button" onclick="noeditlgroup('+gid+', '+ id +');" value="' + TXT_CANCEL + '" class=button >';
	}
	outtxt += '<input type="hidden" value="" name="err"><div class=error id="listgroupbrowsesearcher" style="display: none"></div></form></span><br />';
	return outtxt;
}


// insert friend in group
function selectinfriend( script, id, error)
{
    if (frcount > 0)
    {
        txt = TXT_ENTER_FRIEND;
        tag = '';  
    }
    else
    {
        txt = TXT_NO_FRIENDS;
        tag = "disabled";
    }
	if (!(error)) error = "groupbrowsesearcherr";
	var outtxt = '<div style="margin: 0px;" id="divsel'+id+'"><form onsubmit="return ' + script + '(this)">';
	outtxt += '<input type="text" name="search" id="searchmy' + id + '" predictive="category_friends.php?atoken='+auth_token+'&&mydomain='+appdomain+'" allownew=0 usevalue=1 helper="' + TXT_ENTER_FRIEND + '" style="width: 200px;" ' + tag + '>';
	outtxt += '<input name="" type="submit"  class=button value="' + TXT_ADD + '">';
	outtxt += '<div class=error id="'+error+'" style="display: none"></div></form></div>';
	return outtxt;
}

// search especial para o invite
function searchininvite( script, id, inival)
{
	var ini = isdefined( inival ) ? inival : '';

	//var iniin = isdefined( inicateg ) ? inicateg : '';
	var id1 = isdefined( id ) ? 'id="srch' + id + '"' : '';
	var outtxt = '<div style="margin: 1px;"><form onsubmit="return ' + script + '(this)">';
	outtxt += '<input helper="' + TXT_SEARCH + '" oonfocus="inputfocus(this,1)" oonblur="inputfocus(this,0)" type="text" name=search  '+ id1 + ' class="inputtext inputsearch box" value="" helper="' + ini + '" style="width: 190px">';
	outtxt += '<input name="" type="submit"  class=button value="' + TXT_FIND + '" style="margin-top: 0px">';
	outtxt += '</form></div>';
	return outtxt;
}


// search especial para o browse de comments
function searchinfriend( script, id, inival)
{
	var otop = ie ? 0 : -6;
	var ini = isdefined( inival ) ? inival : '';

	//var iniin = isdefined( inicateg ) ? inicateg : '';
	var id1 = isdefined( id ) ? 'id="srch' + id + '"' : '';
	var outtxt = '<div style="margin: 1px;"><form target="lixo'+id+'" onsubmit="' + script + '(this); return false;">';
	outtxt += '<input helper="' + TXT_SEARCH + '" oonfocus="inputfocus(this,1)" oonblur="inputfocus(this,0)" type="text" name=search  '+ id1 + ' class="inputtext inputsearch box" value="' + ini + '" style="width: 190px">';
	outtxt += '<input name="" type="submit"  class=button value="' + TXT_FIND + '" style="margin-top: 0px">';
	outtxt += '</form></div><div id="lixo'+id+'" style="display: none"></div>';
	return outtxt;
}

// search especial para o browse de comments
function searchincomm( script, id, inival, iniin, type)
{
	var otop = ie ? 0 : -6;
	var ini = isdefined( inival ) ? inival : '';
	//var iniin = isdefined( inicateg ) ? inicateg : '';
	var id1 = isdefined( id ) ? 'id="srch' + id + '"' : '';
	var id2 = isdefined( id ) ? 'id="srchin' + id + '"' : '';
//	ini = 'pizza';
//	var outtxt = '<div style="margin: 1px;"><form onsubmit="return ' + script + '(this)"><table><tr><td>Search:</td> <td>Search In:</td> <td>&nbsp;</td></tr> <tr>';
	var outtxt = '<div style="margin: 1px;"><form onsubmit="return ' + script + '(this)">';
	outtxt += '<input helper="' + TXT_SEARCH + '" type="text" name=search  '+ id1 + ' class="inputtext inputsearch box" value="' + ini + '" style="width: 155px">';
	//outtxt += '<td><select width=10  '+ id2 + '  name=srchin class="searchfield"><option value="1">All</option><option value="0" selected>Friends</option></select></td>';
	outtxt += '<input name="" type="submit"  class=button value="' + TXT_SEARCH + '" style="margin-top: 0px">';
	outtxt += '</form></div>';
	return outtxt;
}

// funcao que parse o xml do menu de navegacao e desenha o mesmo
function resultnavbar( xml, obj )
{
	var i, outtxt = '';
	var name, url, list, ident, left, right;
	var cl = '';

	//get my script
	myloc = document.location + '';
	if(myloc.indexOf('?') != -1) myloc = myloc.substring(0,myloc.indexOf('?'));
	myloc = myloc.substring( myloc.lastIndexOf( '/' )+ 1 );
	if( myloc == '' ) myloc = 'index.php';

	outtxt = '<div class=logodata>';
	outtxt += '<img src="tool/' + ctable + '/logo.gif" id="logomarca">';
	outtxt += '</div>';

	outtxt += '<div class=logdetail>';
	outtxt += datestr;
	outtxt += loginname != '' ? '<br>Signed in as: <b>' + loginname + '</b>' : '<br>';
	outtxt += '<br><A href="mailto:retail@entmediaworks.com">CONTACT</a>';
	if( loginname != '' ) outtxt += ' | <A href="signout.php">LOGOUT</a>';
	else outtxt += ' | <a href="signin.php">SIGN IN!</a>';
	outtxt += '</div>';

	list = ntag( xml, 'opt' )
	var selected = null;
	if( list != null && list.length )
	{
		outtxt += '<div class=mainopt><table cellpadding=0 cellspacing=0 border=0><tr>';
		for( i = 0 ; i < list.length ; i++ )
		{
			var sel = navselect( list[i] );
//			cl = sel ? ' class="mainopt_sel"' : '';
			cl = sel ? ' id="mainopt_sel"' : '';
			if( sel ) selected = list[i];
			name = vtag( list[i], 'name' )
			url = vtag( list[i], 'url' )
			outtxt += '<td ' + cl + '><a href="' + url + '" id="mid' + i + '"><nobr>' + name + '</nobr></a></td>';
		}
		outtxt += '</tr></table></div>';
	}
	list = null;
	if( selected ) { list = ntag( selected, 'subopt' ) }
	var selected = null;
	var hassub = false;
	if( list != null && list.length )
	{
		outtxt += '<div class=subopt><table cellpadding=0 cellspacing=0 border=0><tr>';
		for( i = 0 ; i < list.length ; i++ )
		{
			var sel = navselect( list[i] );
			cl = sel ? ' class="subopt_sel"' : '';
			if( sel ) selected = list[i];
			name = vtag( list[i], 'name' )
			url = vtag( list[i], 'url' )
			outtxt += '<td ' + cl + '><a href="' + url + '" id="mid' + i + '"><nobr>' + name + '</nobr></a></td>';
		}
		outtxt += '</tr></table></div>';
		hassub = true;
	}
	obj.innerHTML = outtxt;
	if( $('mainopt_sel') ) $('mainopt_sel').className = hassub ? 'mainopt_selsub' : 'mainopt_sel';
}

var loginname = '';
var datestr = '';

// faz o desenho de header e menu de uma pagina. 
// pega o conteudo da navbar via ajax 
function initpage( url, login, date )
{
	var i, rb, b;

	//strip scripts from body to copy
	nb = ce('div');
	nb.id = 'navbar';
	nb.className = 'navbar';
	loginname = login;
	datestr = date;
	document.body.appendChild( nb );
	ajaxrequest( url  + '?1', 'resultnavbar', nb, 1 );
	document.body.style.display = 'block';
}

// parametro randomico para enganar o cache das chamadas ajax
function rpar()
{
	return '?' + Math.random();
}

// precacheia uma lista de imagens
function preload()
{
	var i;
	for( i = 0 ; i < arguments.length ; i++ )
	{
		imglist[i] = new Image;
		imglist[i].src = arguments[i];
	}
}

// a partir de um objeto, vai subindo e retorna o objeto que contem um formulario ajax
function mywin( node )
{
	while( (node.tagName != 'DIV' && !isdefined( node.formdiv )) && node != document.body )
	{
		node = node.parentNode;
	}
	return node;
}



// parte um texto de classe classname com uma largura maxima de maxwid
function splittext( classname, maxwid, stext )
{
	var tmp = ce( 'div' );
	var i, j;
	tmp.className = classname;
	tmp.style.position = 'absolute';
	tmp.style.left = -10000;
	tmp.style.width = '';

	var txtsplit = stext.split( / |\n/ );

	document.body.appendChild( tmp );
//	tmp.style.width = '10px';
	tmp.style.width = 'auto';
	var k = 40;
	for( i = 0 ; i < txtsplit.length ; i++ )
	{
		tmp.innerHTML = txtsplit[i];
		if( tmp.clientWidth > maxwid )
		{
			var out = txtsplit[i];
			for( j = 1 ; j < out.length && j < 1000; j++ )
			{
				tmp.innerHTML = out.substring( 0, j );
				if( tmp.clientWidth > maxwid )
				{
					out = out.substring( 0, j - 5) + '<br>' + out.substring( j-5, 10000 );
				}
			}
			txtsplit[i] = out;
			tmp.innerHTML = txtsplit[i];
		}
	}
	document.body.removeChild( tmp );
	return txtsplit.join( ' ' );

	
	dim = 5;
	while( 1 && tmp.clientHeight > maxheight )
	{
		stext = stext.substring( 0, stext.length - dim );
		while( stext.charAt(stext.length-1).match( /[a-zA-Z<]/ ) )
			stext = stext.substring( 0, stext.length - 1 );
		stext += more;
		if( dim < more.length ) dim += more.length;
		tmp.innerHTML = stext;
	}
	return stext;
}


// limita um texto de classe classname, para uma altura maxima (maxheight). Caso desejado
// passa um maximizesscript e coloca a mensagem [ more ] para fazer o texto aumentar
function shrinktext( classname, maxheight, stext, maximizescript, moreflag )
{
	var tmp = ce( 'div' );
	var more = moreflag ? ' ... [ <a href="javascript:'+ maximizescript + '">+ more</a> ]' : '...';
	tmp.className = classname;
	tmp.style.position = 'absolute';
	tmp.style.left = -10000;

	//#-- If more length string will be wrap into multi line.
//	stext = stext.wordWrap(38, "\n", true);
	//#--
	
	tmp.innerHTML = stext;
	
	document.body.appendChild( tmp );
	dim = 5;

	while( 1 && tmp.clientHeight > maxheight )
	{
		stext = stext.substring( 0, stext.length - dim );
		while( stext.charAt(stext.length-1).match( /[a-zA-Z<]/ ) )
			stext = stext.substring( 0, stext.length - 1 );
		stext += more;
		if( dim < more.length ) dim += more.length;
		tmp.innerHTML = stext;
	}
	document.body.removeChild( tmp );
	return stext;
}

function imgmaxrectcenter( img, width, height )
{
	if( !isdefined( width ) ) return;
	if( !isdefined( height ) ) return;
	if( !isdefined( img.tim ) ) img.tim = 0;
	if( img.tim < 10 && (img.width == 0 || img.clientWidth <= 0 ) )
	{
		img.tim++;
		setTimeout( function() { imgmaxrectcenter( img, width, height ); }, img.tim * 20 + 1 );
		return;
	}
	imgmaxrect( img, width, height );
	img.style.position = 'relative';
	img.style.left = Math.floor( (width-img.clientWidth)/2 );
	img.style.top = Math.floor( (height-img.clientHeight)/2 );
}

function imgmaxrect(img, width, height)
{
	if( !isdefined( width ) ) return;
	if( !isdefined( height ) ) return
	if( !isdefined( img.tim ) ) img.tim = 0;
	if( img.tim < 10 && (img.width == 0 || img.clientWidth <= 0 ) )
	{
		
		img.tim++;
		setTimeout( function() { imgmaxrect( img, width, height ); }, img.tim * 20 + 1 );
		return;
	}
	var r = 1;
	if( !isdefined( img.nheight ) )
	{
		img.nheight = img.height;
		img.nwidth = img.width;
	}
	var w = img.nwidth;
	var h = img.nheight;
	
	if( w == -1 )
	{
		debug( 'reload', img.width );
		setTimeout( function() { imgmaxrect( img, width, height ) }, img.tim * 20 + 1 );
		return;
	}

	if (width<w || height<h)
	{
		var mh= height/h;
		var mw= width/w;
		if(mh>mw)  r=mw; else  r=mh;
	}

	img.style.width = w = Math.floor( w*r );
	img.style.height = h = Math.floor( h*r );

	img.style.marginLeft = 0;
	img.style.marginTop = 0;
	var o = img.parentNode;
	if( typeof( o ) == 'Object' )
	{
		while( o != document.body && o.parentNode != null && o.onmouseover == null ) o = o.parentNode;
		if( isdefined( o.onmouseover ) ) o.title = img.title;
	}
	img.isloaded = true;
}



function imgsquare( img, min )
{
	if( !isdefined( min ) ) return;
	if( !isdefined( img.tim ) ) img.tim = 0;
	if( img.tim < 10 && (img.width == 0 || img.clientWidth <= 0 ) )
	{
		img.tim++;
		setTimeout( function() { imgsquare( img, min ); }, img.tim * 20 + 1 );
		return;
	}
	var r = 1;
	if( !isdefined( img.nheight ) )
	{
		img.nheight = img.height;
		img.nwidth = img.width;
	}
	var w = img.nwidth;
	var h = img.nheight;
	var m;
	if( img.src.indexOf( 'fbstores' ) > 0 )
	{
		m = w > h ? w : h;
	}
	else
	{
		m = w < h ? w : h;
	}

	if( m > min ) r = min/m;

	img.style.width = Math.floor( w*r );
	img.style.height = Math.floor( h*r );

	var left;
	var top;
	if( img.clientWidth > min )
	{
		left = -Math.floor( (img.clientWidth - min)/2 );
		top = Math.floor( (min - img.clientHeight)/2 ); 
	}
	else if( img.clientHeight > min )
	{
		top = -Math.floor( (img.clientHeight - min)/2 );
		left = Math.floor( (min - img.clientWidth)/2 ); 
	}
	else
	{
		top = Math.floor( (min - img.clientHeight)/2 ); 
		left = Math.floor( (min - img.clientWidth)/2 ); 
	}
	img.style.marginLeft = left;
	img.style.marginTop = top;
//	debug( '<img style="border: 1px solid black" src="' + img.src + '">', img.clientWidth, img.clientHeight, img.style.left, img.style.top );
	var o = img.parentNode;

	if( typeof( o ) == 'Object' )
	{
		while( o != document.body && o.parentNode != null && o.onmouseover == null ) o = o.parentNode;
		if( isdefined( o.onmouseover ) ) o.title = img.title;
	}
	img.isloaded = true;
}



function imgmaxdimmiddle( img, max )
{
	if( !isdefined( img.tim ) ) img.tim = 0;
	if( img.tim < 10 && (img.width == 0 || img.clientWidth <= 0 ) )
	{
		img.tim++;
		setTimeout( function() { imgmaxdimmiddle( img, max ); }, img.tim * 20 + 1 );
		return;
	}
	imgmaxdim( img, max );
	img.style.position = 'relative';
	img.style.left = Math.floor( (max-img.clientWidth)/2 );
}

function imgmaxdimcenter( img, max )
{
	if( !isdefined( img.tim ) ) img.tim = 0;
	if( img.tim < 10 && (img.width == 0 || img.clientWidth <= 0 ) )
	{
		img.tim++;
		setTimeout( function() { imgmaxdimcenter( img, max ); }, img.tim * 20 + 1 );
		return;
	}
	imgmaxdim( img, max );
	img.style.position = 'relative';
	img.style.left = Math.floor( (max-img.clientWidth)/2 );
	img.style.top = Math.floor( (max-img.clientHeight)/2 );
}

function imgmaxdim(img, max)
{
	if( !isdefined( img.tim ) ) img.tim = 0;
	if( img.tim < 10 && (img.width == 0 || img.clientWidth <= 0 ) )
	{
		img.tim++;
		setTimeout( function() { imgmaxdim( img, max ); }, img.tim * 20 + 1 );
		return;
	}
	var r = 1;
	var left = parseInt( img.offsetLeft + 0 );
	var top = parseInt( img.offsetTop + 0 );
	if( !isdefined( img.nheight ) )
	{
		img.nheight = img.height;
		img.nwidth = img.width;
	}
	var w = img.nwidth;
	var h = img.nheight;
	if( w == -1 )
	{
		//debug( 'reload', img.width );
		setTimeout( function() { imgmaxdim( img, max ) }, img.tim * 20 + 1 );
		return;
	}
	var m = w > h ? w : h;
	if( m > max ) r = max/m;

	img.width = Math.floor( w*r );
	img.height = Math.floor( h*r );
	var w2 = img.width;
	var h2 = img.height;
	var m2 = w2 > h2 ? w2 : h2;
	if( m2 > max )
	{
//		debug( 'force' );
		img.style.width = Math.floor( w*r );
		img.style.height = Math.floor( h*r );
	}
//	debug( img.src, w, h, r, 'x', img.width, img.height );
	if( left <= 0 ) 
	{
		img.style.left = Math.floor((max-img.height)/2);
		img.style.left = 0;
	}
	if( top < 0 )
	{
		img.style.position = 'relative';
		img.style.top = 0;
	}
	var o = img.parentNode;
	while( o != document.body && o.parentNode != null && o.onmouseover == null ) o = o.parentNode;
	if( isdefined( o.onmouseover ) ) o.title = img.title;
	img.isloaded = true;
}

function errorlog( component, str )
{
	alert( component + ': ' + str );
}


// carrega o conteudo de uma url em um div
function loadhtml( div, url ){	ajaxrequest( url + rpar(), 'resulttxt', div, 0 ); }


// pega o irmao seguinte a um objeto
function getnext( o )
{
	var childs = o.parentNode.childNodes;
	for( var i = 0 ; i < childs.length - 1 ; i++ )
		if( childs[i] == o ) return childs[i+1];
	return null;
}

// pega o irmao anterior a um objeto
function getprev( o )
{
	var childs = o.parentNode.childNodes;
	for( var i = 1 ; i < childs.length ; i++ )
		if( childs[i] == o ) return childs[i-1];
	return null;
}


// decora um button
function buttonize( o )
{
	var wid;
	o.className = 'button';
	return;
}




// procura todos os buttons de um objeto e decora
function buttonizeall( o )
{
	var i;
	var ilist = o.getElementsByTagName("INPUT");
	for( i = 0 ; i < ilist.length ; i++ )
	{
		var def = ilist[i].getAttribute( 'default');
		if( ilist[i].type == 'text' && isdefined(def) && def > '' )
		{
			ilist[i].onfocus = function() { inputfocus(this,1); };
			ilist[i].onblur = function() { inputfocus(this,0); };
			ilist[i].onblur();
		}
		if( ilist[i].type == 'button' || ilist[i].type == 'submit' || ilist[i].type == 'reset' )
			buttonize( ilist[i] );
	}
	var ilist = o.getElementsByTagName("SELECT");
	for( i = 0 ; i < ilist.length ; i++ )
	{
//		selectbox( ilist[i] );
	}

}


function baropen( bar )
{
	if( bar.className == 'buttonbar_up' )
	{
		bar.className = 'buttonbar_dn';
		return false;
	}
	else
	{
		bar.className = 'buttonbar_up';
		return true;
	}
}

function selfclick( url )
{
	var frm = $('selflink');
	if( frm != null )
	{
		frm.action=url;
		frm.submit();
	}
	else {
		document.location.href = url;
	}
}

function topclick( url )
{
	var frm = $('toplink');
	if( frm != null )
	{
		frm.action=url;
		frm.submit();
	}
	else {
		top.document.location.href = url;
	}
}

function blankclick( url )
{
	var frm = $('blanklink');
	if( frm != null )
	{
		frm.action=url;
		frm.submit();
	}
	else 
    {
		window.open(url);
	}
}

function varbase()
{	
	var loc = document.location + '';
	var idx = loc.lastIndexOf( '/' );
	loc = loc.substr( idx + 1, 10000 );
	var idx = loc.indexOf( 'fb_sig' );
	loc = loc.substr( 0, idx );
	return loc;
}

function varrecover( n )
{ 
	var curvar = n;
	n = escape(varbase() + '_' + n);
	var dc = document.cookie.split( '; ' );
	for( var i = 0 ; i < dc.length ; i++ )
	{
		var tmp = dc[i].split( '=' );
		if( tmp[0] == n ) return tmp[1]*1;
	}
	//Added by kamalakannan on 14-09-07 for viewoption set in mystart page
	if(varbase() == 'mystart.php')
		return (curvar =='currentmode')?1:0;
	else
		return 0;
}


function varrecover_s( n )
{	
	var vFileName = varbase();
	vFileName = vFileName.toString().split("?");
	vFileName = vFileName[0];
	if(vFileName == 'products.php')
		n = escape(vFileName + '_' + n);
	else	
		n = escape(varbase() + '_' + n);
	var dc = document.cookie.split( '; ' );
	for( var i = 0 ; i < dc.length ; i++ )
	{
		var tmp = dc[i].split( '=' );		
		if( tmp[0] == n ) return tmp[1];
	}
	return '';
}


function vargarbage( n, lim )
{ 
	var script = n;
	script = script.substr( 0, script.indexOf( '.php' ) + 4 );
	
	var names = document.cookie.split( '; ' );
	//alert(names);
	var ct = 0;
	var cookie_date = new Date ( );  // current date & time
	cookie_date.setTime ( cookie_date.getTime() - 1 );
	for( var i = names.length-1 ; i > 0 ; i-- )
	{
		var name=names[i].substring(0,(names[i].indexOf("=", 0)));
		if( name.indexOf( script ) == 0 )
		{
			ct++;
//			alert( tmp[0] );
			if( ct > lim )
			{
//				debug( 'delete', name, script );
				//alert(name+"=; expires=" + cookie_date.toGMTString());
				document.cookie=name+"=; expires=" + cookie_date.toGMTString();
			}
		}
	}
//	alert( script + ', ' + ct );
}

function varsave( n, v )
{	
	var nn = n;
	var vFileName = varbase();
	vFileName = vFileName.toString().split("?");
	vFileName = vFileName[0];
	if(vFileName == 'products.php')
		n = escape(vFileName + '_' + n);
	else
		n = escape(varbase() + '_' + n);
		
	//var names = document.cookie.split( '; ' );
	//alert(names);
	if( v == '' && v != 0 )
	{
		var cookie_date = new Date ( );  // current date & time
		cookie_date.setTime ( cookie_date.getTime() - 1 );
		alert( 'x' );
		document.cookie = n +"=; expires=" + cookie_date.toGMTString();
	}
	else
		document.cookie = n + '=' + v;
//	if( getCookie (n) == '' ) alert( 'cookie ' + n + ' blocked'  );
	vargarbage( n, 6 );
}

function nocache( url )
{
	var ret;
	if( url.indexOf('?') > 0 )
		ret = url + '&rpar=' + Math.random();
	else
		ret = url + '?rpar=' + Math.random();
	return ret;
}

function getTop(obj)
{
  var top = obj.offsetTop;
  while((obj = obj.offsetParent) != null) top += obj.offsetTop;
  return top;
}

function getLeft(obj)
{
  var left = obj.offsetLeft;
  while((obj = obj.offsetParent) != null) left += obj.offsetLeft;
  return left;
}



function getCSSValue( o, v )
{
	if( o == null || !isdefined( o.style ) ) return '';
	if( !ie )
	{
		var cs = document.defaultView.getComputedStyle( o, null );
		return cs[v];
	}
	else
		return o.currentStyle[v];
}

function getCSSValueNum( o, v )
{
	r = parseInt(getCSSValue(o,v));
	if( isNaN(r) ) r = 0;
	return r;
}


function saveCSSValues( o, vs )
{
	var arr = vs.split(',');
	o.saveCSS = new Object;
	for( var i = 0 ; i < arr.length ; i++ )
		o.saveCSS[arr[i]] = getCSSValue( o, arr[i] );
}

function restoreCSSValues( o )
{
	for (var v in o.saveCSS)
		o.style[v] = o.saveCSS[v];
}

function getHeight( o )
{
	if( o == null ) return 0;
	var bt = getCSSValueNum( o, 'borderTopWidth' );
	var bb = getCSSValueNum( o, 'borderBottomWidth' );
	if( bt == 0 ) o.style.borderTop = '1px solid red';
	if( bb == 0 ) o.style.borderBottom = '1px solid red';
	var h = o.offsetHeight;
	if( bt == 0 )
	{
		o.style.borderTop = '';
		h--;
	}
	if( bb == 0 )
	{
		o.style.borderBottom = '';
		h--;
	}
	if( !ie )
	{
		if( bt > 0 ) h -= bt;
		if( bb > 0 ) h -= bb;
		var pt = getCSSValueNum( o, 'paddingTop' );
		var pb = getCSSValueNum( o, 'paddingBottom' );
		if( pt > 0 ) h -= pt;
		if( pb > 0 ) h -= pb;
	}
	if( h < 0 ) h = 0;
	return h;
}


function getWidth( o )
{
	if( o == null ) return 0;
	var bl = getCSSValueNum( o, 'borderLeftWidth' );
	var br = getCSSValueNum( o, 'borderRightWidth' );
	if( bl == 0 ) o.style.borderLeft = '1px solid red';
	if( br == 0 ) o.style.borderRight = '1px solid red';
	var w = o.offsetWidth;
	if( bl == 0 )
	{
		o.style.borderLeft = '';
		if( !ie ) w--;
	}
	if( br == 0 )
	{
		o.style.borderRight = '';
		if( !ie ) w--;
	}
	if( !ie )
	{
		if( bl > 0 ) w -= bl;
		if( br > 0 ) w -= br;
		var pl = getCSSValueNum( o, 'paddingLeft' );
		var pr = getCSSValueNum( o, 'paddingRight' );
		if( pl > 0 ) w -= pl;
		if( pr > 0 ) w -= pr;
	}
	if( v < 0 ) v = 0;
	return w;
}



var uniqueajaxreq = null;
function uniqueajax(url, callback_function, callback_param, return_xml)
{
	if( uniqueajaxreq != null && uniqueajaxreq.readyState != 4 ) 
	{
		if( !ie ) uniqueajaxreq.aborted = true;
		uniqueajaxreq.abort();
	}
	uniqueajaxreq = ajaxrequest(url, callback_function, callback_param, return_xml);
}

function selectset( o, v )
{
	for( i = 0 ; i < o.options.length ; i++ )
		if( o.options[i].text == v || o.options[i].value == v ) 
		{
			o.selectedIndex = i;
			return;
		}
}

var bubble_zidx = 1000;
var bubblecnt = 0;

function bubbleins( obj, ident )
{
	var dv = ce( 'DIV' );
	dv.className = ident;
	obj.appendChild( dv );
	return dv;
}

function bubblelize( obj, arrow, opacity )
{
	if( obj.done ) return;
	var width = obj.clientWidth;
	var height = obj.clientHeight;

	if( height < 16 ) obj.style.height = height = 16;
	var x = obj.left;
	var y = obj.top;
	var sx = x + '';
	var sy = y + '';
	if( sx.match( /%/ ) || sy.match( /%/ ) )
	{
		x = obj.offsetLeft;
		y = obj.offsetTop;
	}
	if( isdefined( obj.bubble ) && obj.bubble != null )
	{
		obj.bubble.parentNode.removeChild( obj.bubble );
		obj.bubble = null;
	}
	var bubble = ce( 'DIV' );
	bubble.className = 'bubble';
	bubble.style.top = -1000;
	bubble.style.left = -1000;
	obj.parentNode.appendChild( bubble );
	var ne = bubbleins( bubble, 'NE' );
	var nw = bubbleins( bubble, 'NW' );
	var se = bubbleins( bubble, 'SE' );
	var sw = bubbleins( bubble, 'SW' );
	var s = bubbleins( bubble, 'S' );
	var n = bubbleins( bubble, 'N' );
	var w = bubbleins( bubble, 'W' );
	var e = bubbleins( bubble, 'E' );
	var bg = bubbleins( bubble, 'bg' );
	var arr = bubbleins( bubble, 'pt' + arrow );
	if( isdefined( opacity ) )
	{
		var tmp = [ ne, nw, se, sw, s, n, w, e, bg, arr ];
		for( var i = 0 ; i < tmp.length ; i++ )
		{
			tmp[i].style.opacity=opacity;
			tmp[i].style.filter = 'alpha(opacity=' + opacity*100 + ')';
		}
	}

	var dw = e.clientWidth + w.clientWidth;
	var dh = n.clientHeight + s.clientHeight;

	bg.style.width = width;
	bg.style.height = height;
	bg.style.top = n.clientHeight;
	bg.style.left  = w.clientWidth;
	e.style.top = ne.clientHeight;

	var vh = height + dh - ne.clientHeight - se.clientHeight;
	if( vh <= 0 )
	{
		e.style.display = w.style.display = 'none';
	}
	e.style.height = vh;
	w.style.top = nw.clientHeight;
	w.style.height = vh;
	n.style.left = nw.clientWidth;
	n.style.width = width;
	s.style.left = sw.clientWidth;
	s.style.width = width;


	arrw = arrow.match( /W/ ) ? 8 : -8;
	if( arrow == ''  )
	{
		arrw = 0;
		toleft = 0;
		tosouth = 0;
		bubble.style.top = y - n.clientHeight;
		bubble.style.left = x - w.clientWidth;
		bubble.style.width = width + dw;
		bubble.style.height = height + dh;
	}
	else
	{
		toleft = arrow.match( /E/ ) ? -(width + dw) : 0;
		tosouth = arrow.match( /S/ ) ? -(height + dh) : 0;
		obj.style.top = y + n.clientHeight + tosouth;
		obj.style.left = x + w.clientWidth + arrw + toleft;
		bubble.style.top = y - n.clientHeight + tosouth;
		bubble.style.left = x + arrw + toleft;
		bubble.style.width = width + dw;
		bubble.style.height = height + dh;
		var cornerdel = arrow.toLowerCase() + '.style.display=\'none\'';
		eval( cornerdel );
	}
	if( obj.bgdiv != null ) obj.bgdiv.style.zIndex = bubble_zidx++;
	bubble.style.zIndex = bubble_zidx++;
	obj.style.zIndex = bubble_zidx++;
	obj.bubble = bubble;
}


var bubblelist = [];

function sbubble( str, top, left, maxwidth, opacity, forcearr )
{
	var bcontent = ce('div');
	if (vnobubble == 1) return bcontent;
	bcontent.className = 'bubblecontent';
	document.body.appendChild( bcontent );
	bcontent.maxwidth = maxwidth;
	bcontent.opacity = opacity;
	bcontent.forcearr = forcearr;
	bcontent.style.top = -1000;
	bcontent.style.left = -1000;
	bcontent.innerHTML = str;
	bcontent.top = top;
	bcontent.left = left;
	bcontent.bgdiv = null;
	var tmpwid = bcontent.clientWidth*1;
	if( tmpwid & 1 ) bcontent.style.width = tmpwid + 1;
	if( bcontent.clientWidth > maxwidth ) bcontent.style.width = maxwidth;
	if( ie )
	{
		var tmpheight = bcontent.clientHeight*1;
		if( tmpheight & 1 ) bcontent.style.height = tmpheight + 1;
	}
	var arr = top > bcontent.clientHeight + 20 ? 'S' : 'N';
	arr += left > 600 ? 'E' : 'W';
	if( isdefined( forcearr ) ) arr = forcearr;
	bubblelize( bcontent, arr, opacity );
	bcontent.id = 'bubble_' + bubblecnt;
	bcontent.bcount = bubblecnt++;
	bcontent.initop = top;
	bcontent.inileft = left;
	bubblelist.push( bcontent );
	return bcontent;
}

function abubble( url, top, left, width, opacity, forcearr )
{
	nobubble();
	var bcontent = ce('div');
	if (vnobubble == 1) return bcontent;
	var bcontent = sbubble( '<div class=ucountlist><div class="loading">' + TXT_LOADING + '</div></div>', top, left, width, opacity, forcearr );
	bcontent.style.width = 'auto';
	bcontent.onchange = function() { bubbleresize( this ) };
	if( url != '' ) ajaxrequest( url, 'bubbleresult', bcontent, 0 );
	return bcontent;
}

function bubbleresize( obj )
{
	var maxwidth = obj.maxwidth;
	var opacity = obj.opacity;
	var forcearr = obj.forcearr;
	var top = obj.initop;
	var left = obj.inileft;
	var bcontent = obj;
	bcontent.style.height = '';
	bcontent.style.top = -1000;
	bcontent.style.left = -1000;
	if( bcontent.clientWidth > maxwidth ) bcontent.style.width = maxwidth;
	if( ie )
	{
		var tmpheight = bcontent.clientHeight*1;
		if( tmpheight & 1 ) bcontent.style.height = tmpheight + 1;
	}
	bcontent.style.top = top;
	bcontent.style.left = left;
	var arr = top > bcontent.clientHeight + 20 ? 'S' : 'N';
	arr += left > 300 ? 'E' : 'W';
	if( isdefined( forcearr ) ) arr = forcearr;
	bubblelize( obj, arr, opacity );
}

function bubbleresult( txt, obj )
{
	resultform( txt, obj );
//	bubbleresize( obj );
}

function bubbleout( obj )
{
	if( !isdefined( obj ) ) return;
	if( isdefined( obj.gbdiv ) ) document.body.removeChild( obj.bgdiv );
	document.body.removeChild( obj.bubble );
	document.body.removeChild( obj );
	obj.done = true;
	for( var i = 0 ; i < bubblelist.length ; i++ )
		if( bubblelist[i] == obj )
			delete( bubblelist[i] );
}

function bubbleoutcheck( ev )
{
	if( ie ) ev = event;
	var target = ie ? ev.srcElement : ev.target;
	var inbubble = upDom( target, 'bubbleobj' ) != null;
	if( !inbubble )
	{
		nobubble();
		closeCalendar();
		document.body.onmousedown = null;
	}
	return true;
}

function nobubble()
{
	var bub;
	while( isdefined( bub = bubblelist.pop() ) )
		bubbleout( bub );
}

var imglist = new Array;

function govenue( vid , src)
{
	var url = nocache( 'comment.php?id=' + vid + '&sr='+ src +'&atoken=' + auth_token  + '&mydomain=' + appdomain);
	document.location = url;
}


function govenueYahoo( vid , src, ext)
{
//	debug( vid, src, ext );
//	var url = nocache( 'comment.php?vrid=' + vid + '&ext='+ ext +'&atoken=' + auth_token );
	var url = nocache( 'comment.php?vrid=' + vid + '&sr='+ src +'&ext='+ ext +'&atoken=' + auth_token + '&mydomain=' + appdomain);
	document.location = url;
}

function govenueext( vid , src, ext)
{
	var url = nocache( 'comment.php?vrid=' + vid + '&sr='+ src +'&ext='+ ext +'&atoken=' + auth_token + '&mydomain=' + appdomain);
	document.location = url;
}


function unlinked( bcount )
{
	pinpointout();
	rvbrowserefresh( bcount, 0 );
}

function unlinkme (vid, vsr, time, bcount) {
	if( !confirm( 'Delete this entry?' ) ) return;
	var urlget = 'unlinkme.php?vid=' + vid + '&&type=' + vsr + '&bcount=' + bcount + '&atoken=' + auth_token + '&pan=vbrowse&time=' + time + '&mydomain=' + appdomain;
	//window.open(urlget);
	ajaxrequest( urlget, function() { unlinked( bcount ) }, $('rvbrowse'+bcount), 0 );
}

function plural( v )
{
	return v == 1 ? '' : 's';
}

var ucount_tm = null;
var ucount_ajax = null;
function ucountover( obj )
{
	nobubble();
	clearTimeout( ucount_tm );
	var vid = obj.getAttribute( 'vid')*1;
	var vsr = obj.getAttribute( 'vsr')*1;
	var vrid = obj.getAttribute( 'vrid')*1;
	var city = obj.getAttribute( 'city' );
	var state = obj.getAttribute( 'state' );
	var country = obj.getAttribute( 'country' );
	var nfriends = obj.getAttribute( 'friends')*1;
	var nusers = obj.getAttribute( 'users')*1;
	var uflag = obj.getAttribute( 'uflag')*1;
	var top = getTop( obj );
	var left = getLeft( obj );
	var labels = [];
	if( nfriends > 0 ) labels.push( msg( TXT_POP_NUSR, nfriends, nfriends == 1 ? TXT_POP_FRIEND : TXT_POP_FRIENDS ) );
	if( nusers > nfriends ) labels.push( msg( TXT_POP_NUSR, nusers, nusers == 1 ? TXT_POP_USER : TXT_POP_USERS ) );

	if (vsr == 2)
	{
		tag = TXT_POP_UPDATED_HERE ;
	} else {
		tag = TXT_POP_ACTIVE_HERE;
	}

	var label = msg( tag, labels.join( ', ' ) );
	var params = [];
	if( vid > 0 ) params.push( 'vid=' + vid );
	if( vsr > 0 ) params.push( 'vsr=' + vsr );
	if( vrid > 0 ) params.push( 'vrid=' + vrid );
	if( city > '' ) 
	{
		params = [ 'city=' + city ];
	}
	if( obj.getAttribute( 'users') == '-' )
	{

		params.push( 'noPublic=1' );
//		params.push( 'noMe=1' );
	}
	else
		params.push( 'type=6' );

	if( !uflag ) params.push( 'status=1' );
	var param = params.join( '&' );
	var url = 'request_users.php?' + param + '&s=0&m=6&act=0&order=4&search=&atoken=' + auth_token + '&mydomain=' + appdomain;

	top += 3;
	if( left < 300 ) left += obj.clientWidth + 2;
	var div = obj;
	while( div != null && div.className != 'item' )
	{
//		debug( div.tagName, div.id, div.className );
		div = div.parentNode;
	}
	var txt = '<div style="width: 200px; border-bottom: 1px solid #aabbaa; padding-bottom: 5px; margin-bottom: 5px;">' + label + '</div><div class=ucountlist id=ucountlist><div class=loading>' + TXT_LOADING + '</div></div>';
	var bub = sbubble( txt, top, left, 400, 1 );
	bub.onmouseover = function() { clearTimeout( ucount_tm ); div.onmouseover( div, div.bcount, div.idx ) };
	bub.onmouseout = function() { obj.onmouseout( obj ); div.onmouseout( div, div.bcount, div.idx )};

	$('ucountlist').bub = bub;
//	debug( '<a href="' + url + '" target=_blank>link</a>' );
//	debug( 'vid', vid, 'vsr', vsr, 'url', url );

	$('ucountlist').vid = vid;
	$('ucountlist').vsr = vsr;
	uniqueajax( nocache(url), 'resultucount', $('ucountlist'), 1 );
}

function ucountout( obj )
{
	ucount_tm = setTimeout( function() { nobubble() }, 100 );
}

function ucountrec( nodelist )
{
	var cols = new Array;	
	for( var i = 0 ; i < nodelist.length ; i++ )
		cols[i] = nodeval( nodelist[i] );
}

function resultucount( xml, obj, txt )
{
	var labels, frec, lrec, trec, recfunc, i, j, cols;
	var reclist = ntag( xml, 'rec' );
	var bcount = obj.bcount;
	var detailscript = obj.detailscript;
	var url = obj.url;
    obj_old = obj;
	obj = $(obj.id);
    if (obj != null)
        obj.bcount = bcount;
    //else if (myuid == 591323352)
    //    debug('resultucount', obj_old.id, obj_old.bcount);
        


	frec = vtag( xml, 'firstrec' ) * 1;
	lrec = vtag( xml, 'lastrec' ) * 1;
	trec = vtag( xml, 'totrec' ) * 1;
	if( trec > 0)
	{
		var out = '<table cellpadding=0 cellspacing=0 border=0 class=mapuser>';
		for( j = 0, i = frec ; i <= lrec && i < 5 ; i++, j++ )
		{
			var crecs = ntag( reclist[j], 'c' );
			var cols = new Array;	
			for( var c = 0 ; c < crecs.length ; c++ )
				cols[c] = nodeval( crecs[c] );
			var uid = cols[8];
			var usr = cols[9];
			var utime = cols[10];
			var uname = cols[11];
			var uthumb = cols[12];

			out += '<tr><td><div class=square25 style="cursor: pointer" onclick="pinusr(' + uid + ', '+usr+')"><img src="' + uthumb + '" onload="imgsquare( this, 25 )"></td><td class=mapusertxt ><a href="javascript:pinusr(' + uid + ', '+usr+')"><b>' + uname + '</b></a><br>' + utime + '</td></tr>';
		}
		if( trec > 5 )
		{
			var vid = obj.vid;
			var vsr = obj.vsr;
			out += '<tr><td></td><td class=mapusertxt ><a href="javascript:govenue(' + vid + ', ' + vsr + ' )">' + TXT_POP_MORE + '</a></td></tr>';
		}
		out += '</table>';
		obj.innerHTML = out;
		bubbleresize( obj.bub );
	}
	else
	{
		obj.innerHTML = TXT_POP_UNF;
		bubbleresize( obj.bub );
	}
//		nobubble();
}


var optchoosing = null;
function optionset( id, opts, idx, launch, usebracket )
{
	var div = $(id);
	div.opts = opts;
	div.idx = idx;
	div.className = 'optionset';
	if( !isdefined( usebracket ) ) usebracket = true;
	div.usebracket = usebracket;
	div.bleft = !usebracket ? ' ' : '[ ';
	div.bright = !usebracket ? ' ' : ' ]';
	//debug(id);
	//debug(opts);
	//debug(idx);
	//div.innerHTML = '<nobr><a href="javascript:v()" onclick="optionchoose(\'' + id + '\')">[ ' + div.opts[idx][0] + ' ]</a></nobr>';
	div.innerHTML = '<a href="javascript:v()" onclick="optionchoose(\'' + id + '\')">' + div.bleft + div.opts[idx][0] + div.bright + '</a>';
	if( launch ) optionsel( id, idx );
}

function optionsel( id, idx )
{
	//debug(id,idx);
	var div = $(id);
	div.opts[idx][1]( div );
	div.className = 'optionset';
	div.idx = idx;
	savevar(id, idx);
	//div.innerHTML = '<nobr><a href="javascript:v()" onclick="optionchoose(\'' + id + '\')">[ ' + div.opts[idx][0] + ' ]</a></nobr>';
	div.innerHTML = '<a href="javascript:v()" onclick="optionchoose(\'' + id + '\')">' + div.bleft + div.opts[idx][0] + div.bright + '</a>';
}

function optionchoose( id )
{
	//debug('oi1');
	if( optchoosing != null ) 
		optionclose( optchoosing );
	optchoosing = id;

	var div = $(id);
	div.className = 'optdiv';
	var idx = div.idx;
	//div.innerHTML = '<nobr><a href="javascript:v()" onclick="optionsel(\'' + id + '\', ' + idx + ')">' + div.opts[idx][0] + '</a></nobr>';
	div.innerHTML = '<a href="javascript:v()" onclick="optionsel(\'' + id + '\', ' + idx + ')">' + div.opts[idx][0] + '</a>';
	for( var i = 0 ; i < div.opts.length ; i++ )
		if( i != idx )
			//div.innerHTML += '<br><nobr><a href="javascript:v()" onclick="optionsel(\'' + id + '\', ' + i + ')">' + div.opts[i][0] + '</a></nobr>';
			div.innerHTML += '<br><a href="javascript:optionsel(\'' + id + '\', ' + i + ' )">' + div.opts[i][0] + '</a>';
}

function optionclose( id )
{
	var div = $(id);
	if( div != null )
	{
		div.className = 'optionset';
		var idx = div.idx;
		//div.innerHTML = '<nobr><a href="javascript:v()" onclick="optionchoose(\'' + id + '\')">[ ' + div.opts[idx][0] + ' ]</a></nobr>';
		div.innerHTML = '<a href="javascript:v()" onclick="optionchoose(\'' + id + '\')">' + div.bleft + div.opts[idx][0]  + div.bright + '</a>';
	}
	optchoosing = null;
}

var myvars = new Object;

function savevar( param, val, func )
{
	var url = 'savevar.php?';
	var oldval = getvar( param, -1 );

	if( oldval == val ) { 
		//debug (1, param, val, oldval);
		return ;
	}

	url += 'atoken=' + auth_token + '&';
	url += 'mydomain=' + appdomain + '&';
	url += 'ident=' + param + '&';
	url += 'val=' + val + '&';

	if( !isdefined( func ) ) func = '';

	//debug( 'savevar', param, val );
	ajaxrequest(url, func, null, 0);
	eval("myvars."+param+"= '"+val+"';");
}

function getvar (param, def, max) {
	var ret = 0;
	if (!isdefined( myvars ) || !isdefined( myvars[param] ) ) {
		ret = def;
	} else if (myvars[param] <= max || !isdefined(max)) {
		ret = myvars[param];
	} else {
		ret = def;
	}
	//debug( 'myvars', param, def, max, isdefined(myvars), isdefined( myvars[param] ), myvars[param] , ret);
	return ret;
}

function myside (obj){
	if (obj.cfg == 1){
		alert( 'Please complete your mobile registration by replying \'Yes\' to the confirmation text message you receive to your mobile phone' );
	}
}

function removeclass( o, cls )
{
	var cn = o.className + '';
	var regexp = new RegExp( ' ' + cls, 'g' );
	if( cn.match( regexp ) )
	{
		cn = cn.replace( regexp, '' );
	}
	o.className = cn;
}

function addclass( o, cls )
{
	var cn = o.className + ' ';
	cn += cls;
	o.className = cn;
}

// image preload functions
// add images to a preload queue. This will preload gradualy the new images

var preloadimg_queue = [];
var preloadimg_queued = [];
var preloadimgs = [];

function preloadimg( url )
{
	var first = preloadimg_queue.length == 0;
	if( !preloadimg_queued[url] )
	{
		preloadimg_queued[url] = true;
		preloadimg_queue.push( url );
	}
	if( first ) preloadimg_next();
}

function preloadimg_next()
{
	if( preloadimg_queue.length == 0 ) return;
	var url = preloadimg_queue.shift();
	var img = new Image;
	preloadimgs.push( img );
	img.onload = function() { preloadimg_next() };
	img.src = url;
}



function verify_retry( s, myfunction, id)
{
	//debug (s, myfunction, id);
	if (isdefined(id) && id != '')
	{
		secs = $(id);
		out = '';
		for( var i = 5 ; i > s ; i-- )
			out += '. ';
		secs.innerHTML = out;
	}

	if( s > 0 )
		setTimeout( function() { verify_retry( s-1, myfunction, id ); }, 1000 );
	else if (isdefined(myfunction) && myfunction != '')
		myfunction();
}

function verify_act(myfunction, timeout, id, txt)
{
	//debug('act', myfunction, timeout, id, txt);
	if (!isdefined(myfunction))		
		return;
	if (!isdefined(timeout) || timeout == '') 
		timeout = 100;
	if (isdefined(txt) && isdefined(id))
		$(id).innerHTML = txt;
	//debug(myfunction, timeout);
	setTimeout( myfunction, timeout );
	//setTimeout( function() { ajaxrequest('mymobile_ck.php?atoken=<?=$auth_token?>', 'resultform', div, 0 ); }, 100 );
	//setTimeout( function() { ajaxrequest('mymobile_ck.php?atoken=<?=$auth_token?>', 'xx', div, 0 ); }, 100 );
}


var browsername=null;
function browserCSS()
{
	var nav = navigator.userAgent.toLowerCase();
	var browsertype = [ 'chrome', 'firefox', 'msie', 'safari' ];
	var browser = [];
	for( var i = 0 ; i < browsertype.length ; i++ )
		if( nav.indexOf( browsertype[i] ) >= 0 ) browser.push( browsertype[i] );

	html = document.getElementsByTagName('html')[0];
	var bclass = browser.join( ' ' );
	if( !ie && bclass.indexOf( 'chrome' ) >= 0 )
	{
		bclass = bclass.replace( /safari/, '' );
		chrome = true;
	}
	if( !ie && bclass.indexOf( 'safari' ) >= 0 )
		safari = true;
	if( !ie && bclass.indexOf( 'firefox' ) >= 0 )
		firefox = true;
	browsername = bclass;
	if( bclass.indexOf( 'msie' ) >= 0 ) 
		browsername = bclass = bclass.replace( /msie/, 'ie' );
	else
		bclass += ' not_ie';

	soclass= ' win ';
	if( navigator.appVersion.lastIndexOf( 'Mac' ) != -1 )
		soclass= ' mac';
	if( navigator.appVersion.lastIndexOf( 'Linux' ) != -1 )
		soclass= ' linux';

	html.className = soclass+bclass;
}


function removePlus (obj){
	var text = obj.value;
	
	obj.value = text.replace(/\+/g, "{*PLUS*}");
}

function msg()
{
	var args = msg.arguments;
	var str = args[0];
	for( var i = 1 ; i < args.length ; i++ )
		str = str.replace( '$' + i, args[i] );
	return str;
}

function lmenu_sel( idx )
{
	var i = 0;
	var o;
	while( ( o = $('menu'+i) ) != null )
	{
		o.style.fontWeight =  i == idx ? 'bold' : 'normal';
		i++;
	}
}

function lmenu_click( i )
{
	var o = $('menu'+i);
	if( o != null ) o.onclick();
    //lmenu_rewrite(3);
}

function lmenu_rewrite( i )
{
	var o = $('menu'+i);
	if( o != null ) 
    {
        o.innerHTML = '';
    }
}

function lmenu( hang, opts )
{
	var out = [ '<div class="left_menu">' ];
	for( var i = 0 ; i < opts.length ; i++ )
		out.push( '<p><a id="menu' + i + '" href="javascript:;" onclick="lmenu_sel(' + i + ');' + opts[i].click + '">' + opts[i].label + '</a></p>' );
	out.push( '</div>' );
	hang.innerHTML = out.join( '' );
}

function resultmyform(txt, obj) {
	var list = json(txt);
	if ( list.status == 1 ){
		var ns = ce('SCRIPT');
		ns.type = 'text/javascript';
		ns.text = list.okscript;
		document.body.appendChild( ns );
	}
}

function func_register_ajax(id, tag, url, txt) 
{
    var obj = $(id);
    if (obj != null)
    {
        if (tag == 0) 
            ajaxrequest(url, 'resultform', obj, 0);
        else
            obj.innerHTML = "<a href=\"javascript:func_register_ajax('"+id+"', 0, '"+url+"', '"+txt+"');\">"+txt+"</a>" ;
    }
}

function bodycenter( val )
{
	if(!isdefined(val))
		val=1024;

	var cw = document.body.clientWidth;
	var mrg = Math.floor((cw - val)/2);
	if( mrg < 0 ) mrg = 0;
	document.body.style.marginLeft = mrg;
	document.body.style.marginRight = cw-val-mrg;
	document.body.mrg = mrg;
	if( !isdefined( window.onresize ) || window.onresize == null ) window.onresize = function() { bodycenter() };
}

function innerHTML (obj, txt)
{
    if (obj != null) 
        obj.innerHTML = txt;
}

function moeda2float(moeda)
{
   moeda = moeda.replace(/\,/g,"");
   moeda = moeda.replace(".",",");
   moeda = parseFloat(moeda);
   return moeda;
}

/**Função que converte um valor float para um valor em formato monetário
*
*
* @param {float} num Valor em Float
* @return {String} Valor em formato monetário
*/
function float2moeda(num)
{
   x = 0;

   if(num<0) {
   num = Math.abs(num);
   x = 1;
   } if(isNaN(num)) num = "0";
   cents = Math.floor((num*100+0.5)%100);

   num = Math.floor((num*100+0.5)/100).toString();

   if(cents < 10) cents = "0" + cents;
   for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
   num = num.substring(0,num.length-(4*i+3))+','
   +num.substring(num.length-(4*i+3)); ret = num + '.' + cents; if (x == 1) ret = ' - ' + ret;return ret;
}


function closeCalendar() {}
function watch_animate() {}
browserCSS();


