//Flash sem borda
function exibe_swf(URL, WIDTH, HEIGHT, TRANSPARENT) {
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '); 
 document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
 document.write('width="'+ WIDTH +'" height="'+ HEIGHT +'">');
 document.write(' <param name="movie" value="'+ URL +'">');
 document.write(' <param name="quality" value="high">');
 document.write(' <param name="allowFullScreen" value="true">');


 if ( TRANSPARENT ) {
  document.write(' <param name="Wmode" value="transparent">'); 
 }

 document.write(' <embed src="'+ URL +'" quality="high" ');

 if ( TRANSPARENT ) {
  document.write('Wmode = "transparent" ');
 }

 document.write ('pluginspage="http://www.macromedia.com/go/getflashplayer" ');
 document.write ('type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
 document.write ('</object>');
}


/*contador de tempo*/

var segundos = 15;
function conta() {
document.getElementById('tempo').innerHTML=segundos;
	if(segundos == 0) {
        switch($('#carrier').val()){
	case 'claro':
                document.getElementById('celularTempo').innerHTML = "<div id='ctempo'>Não recebeu sua senha? Envie um SMS com a palavra <span>SIM</span> para <span>46969</span></div>";
	break;
	case 'oi':
                document.getElementById('celularTempo').innerHTML = "<div id='ctempo'>Não recebeu sua senha? Envie SMS com a palavra <span>SIM</span> para <span>49908</span></div>";
	break;
	default:
                document.getElementById('celularTempo').innerHTML = "<div id='ctempo'>Não recebeu sua senha? Envie SMS com a palavra <span>SIM</span> para <span>46969</span></div>";
	break;
	}
	}
	if (segundos != 0){
		segundos = segundos-1;
		setTimeout("conta()", 1000);
	}
}
var miles = 100;
function contamile() {
	if(segundos != 0) {
		document.getElementById('milesegundos').innerHTML=miles;
		if(miles == 0) {
			miles = 100;
		}
		if (miles != 0){
			miles = miles-1;
			setTimeout("contamile()", (1/1000));
		}
	}
}
(function($){ 
     $.fn.extend({  
         limit: function(limit,element) {
			
			var interval;
			var self = $(this);
			
			$(this).focus(function(){
				interval = window.setInterval(substring,100);
			});
			
			$(this).blur(function(){
				clearInterval(interval);
				substring();
			});
			
			function substring(){
				length = $(self).val().length;
				if(element)
					$(element).val((limit-length<=0)?'0':limit-length);
				if(length > limit)
					$(self).val($(self).val().substring(0,limit));
			}
			
			substring();
			
        } 
    }); 
})(jQuery);

