function estudioonline() {
	var d=new Date();
	window.open( 'eonline.htm?r='+d.getTime(), 'eonlinefm', 'width=540,height=390,left=50,top=50,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0' );
}

function pub_mpv( objid, w, h, url )
{
	var objDiv = document.getElementById( objid );
	if( !objDiv || objDiv == undefined || objDiv == null ) return;
	
	var opc = {
		TransparentAtStart: 'true',
		ShowControls: 'true',
		AutoPlay: 'true',
		AutoStart: 'true',
		ShowStatusBar: 1,
		uiMode: 'mini',
		EnableContextMenu: 0
	}
	
	var embed = out = opc1 = opc2 = '';
	for( var x in opc )
	{
		opc1 += '<param name="'+x+'" value="'+opc[x]+'" />';
		opc2 += ' '+x+'="'+opc[x]+'"';
	}
	
	h -= 6;
	embed += '<embed src="'+url+'" width="'+w+'" height="'+h+'" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/"'+opc2+'></embed>';
	
	if( isIE )
	{
		var WMP7;
		if( window.ActiveXObject )
		{
			WMP7 = new ActiveXObject("WMPlayer.OCX.7");
		} else if (window.GeckoActiveXObject) {
			WMP7 = new GeckoActiveXObject("WMPlayer.OCX.7");
		}
		if( WMP7 )
		{
			out += '<object id="'+objid+'" width="'+w+'" height="'+h+'" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject">';
			out += '<param name="URL" value="'+url+'" />'+opc1+embed+'</object>';
		} else {
			out += '<object id="'+objid+'" width="'+w+'" height="'+h+'" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715">';
			out += '<param name="FileName" value="'+url+'" />'+opc1+embed+'</object>';
		}
		/* out += embed; */
	} else {
		out += '<object id="'+objid+'" width="'+w+'" height="'+h+'" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" type="application/x-oleobject">';
		out += '<param name="FileName" value="'+url+'" />';
		out += '<param name="URL" value="'+url+'" />'+opc1+embed+'</object>';
	}
	objDiv.innerHTML = out;
}

function promocaoinscricaopascal() {
	window.open( 'http://www.radiocultura.com.br/fm/promocoes-inscricao.htm?id=171', 'pascal', 'width=300,height=380,left=50,top=50,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0' );
}
function jogos() {
	var d=new Date();
	window.open( 'jogos.htm', 'jogos', 'width=540,height=390,left=50,top=50,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0' );
}

var isIE = window.ActiveXObject ? true : false;

function pub_flash( swf, w, h ) {
	document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">'+"\n" );
	document.write( '<param name="movie" value="'+swf+'" />'+"\n" );
	document.write( '<param name="quality" value="high" />'+"\n" );
	document.write( '<param name="menu" value="false" />'+"\n" );
	document.write( '<embed src="'+swf+'" menu="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>'+"\n" );
	document.write( '</object>'+"\n" );
}

function radioonline(flag) {
	if( flag == 1 )
	{
		window.location.reload();
	} else {
		window.open( 'ronline.htm', 'ronlineam', 'width=602,height=190,left=50,top=50,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0' );
	}
}

function pecasucesso() {
	window.open( 'pecasucesso.htm', 'pecasucesso', 'width=300,height=350,left=50,top=50,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0' );
}

function balneabilidade() {
	window.open( 'balneabilidade.htm', 'balneabilidade', 'width=775,height=330,left=30,top=30,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0' );
}

function balsas() {
	window.open( 'balsas.htm', 'balsas', 'width=192,height=250,left=100,top=100,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0' );
}

function ecovias() {
	window.open( 'http://ecovias.terra.com.br/condicoes.asp', 'ecovias', 'width=780,height=600,left=0,top=0,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0' );
}

function pub_mp( objid, w, h, url )
{
	var objDiv = document.getElementById( objid );
	if( !objDiv || objDiv == undefined || objDiv == null ) return;
	
	var opc = {
		TransparentAtStart: 'true',
		ShowControls: 'true',
		AutoPlay: 'true',
		AutoStart: 'true',
		ShowStatusBar: 1,
		uiMode: 'mini',
		EnableContextMenu: 0
	}
	
	var embed = out = opc1 = opc2 = '';
	for( var x in opc )
	{
		opc1 += '<param name="'+x+'" value="'+opc[x]+'" />';
		opc2 += ' '+x+'="'+opc[x]+'"';
	}
	
	h -= 5;
	embed += '<embed src="'+url+'" width="'+w+'" height="'+h+'" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/"'+opc2+'></embed>';
	
	if( isIE )
	{
		var WMP7;
		if( window.ActiveXObject )
		{
			WMP7 = new ActiveXObject("WMPlayer.OCX.7");
		} else if (window.GeckoActiveXObject) {
			WMP7 = new GeckoActiveXObject("WMPlayer.OCX.7");
		}
		if( WMP7 )
		{
			out += '<object id="'+objid+'" width="'+w+'" height="'+h+'" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject">';
			out += '<param name="URL" value="'+url+'" />'+opc1+embed+'</object>';
		} else {
			out += '<object id="'+objid+'" width="'+w+'" height="'+h+'" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715">';
			out += '<param name="FileName" value="'+url+'" />'+opc1+embed+'</object>';
		}
		/* out += embed; */
	} else {
		out += '<object id="'+objid+'" width="'+w+'" height="'+h+'" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95F">';
		out += '<param name="URL" value="'+url+'" />'+opc1+embed+'</object>';
	}
	objDiv.innerHTML = out;
}

function objnome( obj )
{
	var ret = '';
	if( typeof( obj ) != 'object' ) return;
	var v = obj.value.trim().toLowerCase();
	var v = v.replace( '/', '/ ' );
	var a = v.split(" ");
	var prep = ['de','do','dos','da','das','e','ou','del','ltda','ltda.','apto','apto.','ap','ap.','apt','apt','conj','conj.','cj','cj.','sala','sl.','andar'];
	var ignore = ['me','sa','s/a'];
	for( i=0; i<a.length; i++ ) ret += (i>0?' ':'') + ( prep.indexOf(a[i].toLowerCase()) == -1 ? ( ignore.indexOf(a[i].toLowerCase()) == -1 ? a[i].substr(0,1).toUpperCase() + a[i].substr(1) : a[i].toUpperCase() ) : a[i].toLowerCase() );
	
	obj.value = ret;
}

function objemail( obj )
{
	valor = obj.value.toLowerCase(); retorno = ''; x = 0; arr = 0;
	for( c = 0; c < valor.length; c++ )
	{
		letra = asc( valor.substr( c, 1 ) );
		if( x == 0 ) { if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) ) { retorno = retorno + valor.substr( c, 1 ); x = 1; } }
		else {
			if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) || ( letra == 46 ) || ( letra == 95 ) || ( letra == 64 ) )
			{
				if( ( letra == 64 ) && arr == 0 ) { retorno = retorno + valor.substr( c, 1 ); arr = 1; }
				else { if( !( letra == 46 && last == 46 ) && !( letra == 95 && last == 95 ) && !( letra == 46 && last == 64 ) ) { if( x >= 1 ) retorno = retorno + valor.substr( c, 1 ); x = x + 1; }}
			}
		}
		last = letra;
	}
	valor = retorno; retorno = ''; x = 0; pto = 0;
	for( c = ( valor.length - 1 ); c >= 0; c-- )
	{
		letra = asc( valor.substr( c, 1 ) );
		if( letra == 46 ) pto = 1;
		if( x == 0 ) { if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) ) { retorno = valor.substr( c, 1 ) + retorno; x = 1; } }
		else { if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) || ( letra == 46 ) || ( letra == 95 ) || ( letra == 64 ) ) { if( x >= 1 ) retorno = valor.substr( c, 1 ) + retorno; x = x + 1; } }
	}   	
	if( arr == 0 || pto == 0 ) retorno = '';
  	obj.value = retorno; return;
}

function asc( each_char )
{
	var n = 0;
	var char_str = ' !"#$%&' + "'" + '()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
	for (i = 0; i < char_str.length; i++) { if (each_char == char_str.substring(i, i+1)) break; }
	return i + 32;
}

function textmax( obj, max )
{
	str = obj.value; if( str.length > max ) obj.value = str.substring( 0, max );
}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };
Array.prototype.unescape = function() { for(var x=0,len=this.length;x<len;x++) { this[x] = unescape(this[x]); } return this };
Array.prototype.indexOf = function(v) { var r=-1;for(var x=0,len=this.length;x<len;x++) { if( r == -1 && this[x] == v ) r = x; }; return r; };
Array.prototype.inverte = function() { var a=new Array();for(var x=0,len=this.length;x<len;x++) a[x]=this[len-x-1]; return a; };
function pub_mpsc() { pub_mp( 'embedronline', '100%', 70, 'http://radio2.bignet.com.br:8020/' ); }
if ( typeof Array.prototype.push == "undefined" )
	Array.prototype.push = function() { for(var x=0,len=arguments.length;x<arguments.length;x++) this[this.length] = arguments[x]; }


