var classes = new Array('u', 'v');

function MostraAviso(URL)
{
	var day = new Date();
	var id  = day.getTime();
	
	eval("var page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=230,left = 412,top = 234');");

}

function clr(which, src)
{
	src.className = classes[which];
}

function opn(url, width, height, secure)
{
    var left, top, str;

	if ( !url.match(/^http/) )
	{
		url = secure ? 'https://www.1300k.com.br/'+url : 'http://www.1300k.com.br/'+url;
	}
	
	if(screen.width > width)
	{
	    left = parseInt( (screen.width-width)/2 );
		top = parseInt( (screen.height-height)/3 );
    }
	else
	{
	    left = 0;
		top = 0;
		width = screen.width;
		height = screen.height;
	}

	str = 'location=0,resize=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',maximized=0,scrollbars=1';

    hld = window.open(url, 'w'+Math.floor(Math.random()*9999+1), str);
	if(!hld.opener) hld.opener = self;
}

function openAjax()
{
    var ajax;

    try
	{
            ajax = new XMLHttpRequest();
    }

    catch(ee)
    {
        try
        {
            ajax = new ActiveXObject("Msxml2.XMLHTTP");
        }

        catch(e)
        {
            try
            {
                ajax = new ActiveXObject("Microsoft.XMLHTTP");
            }

            catch(E)
            {
                ajax = false;
            }
        }
    }

    return ajax;
}

function Decode(it)
{
    return unescape( it.replace(/\+/g,' ') );
}

function IsN(myEvent)
{
    var key;
    var keychar;

	if(window.event)
	{
       key = window.event.keyCode;
    }
    else if(myEvent)
	{
	    key = myEvent.which;
    }
    else
	{
       return true;
    }

    if( (key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27) )
	{
        return true;
	}

    keychar = String.fromCharCode(key);

    if( ('0123456789').indexOf(keychar)>-1 )
	{
        return true;
    }

	return false;
}

var verifiqueTAB = true;
function Jump(quem, tammax)
{
	if ( (quem.value.length == tammax) && (verifiqueTAB) )
	{
		var i=0,j=0, indice=-1;
		for (i=0; i<document.forms.length; i++) {
			for (j=0; j<document.forms[i].elements.length; j++) {
				if (document.forms[i].elements[j].name == quem.name) {
					indice=i;
					break;
				}
			}
			if (indice != -1)
		         break;
		}
		for (i=0; i<=document.forms[indice].elements.length; i++) {
			if (document.forms[indice].elements[i].name == quem.name) {
				while ( (document.forms[indice].elements[(i+1)].type == "hidden") &&
						(i < document.forms[indice].elements.length) ) {
							i++;
				}
				document.forms[indice].elements[(i+1)].focus();
				verifiqueTAB=false;
				break;
			}
		}
	}
}