function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function desactivar(){
	createCookie("aviso_ie","ok",14);
	window.location="./";
}

function comprobarTitulo(){
	var titulo = document.getElementById("subject").value;
	var timeRegExp = /[\(\[]\d{1,2}:\d{2}[\)\]]$/;
	if(titulo.search(timeRegExp)==-1){
		if(confirm("Pon BIEN la duración al final del título! (por ejemplo: \"[1:20]\")\n¿Deseas corregir tu mensaje?\nSi no lo haces sufrirás las consecuencias...")){
			return false;
		}else{
			return true;
		}
	}
	return true;
}

var message = '<p class="aviso">Su navegador no está soportado oficialmente. Por una web mejor utilice uno que respete los estándares como <a href="http://www.mozilla-europe.org/es/firefox/">Firefox</a>, <a href="http://www.opera.com/browser/">Opera</a> o <a href="http://www.apple.com/es/safari/">Safari</a></p><a class="aviso" href="javascript:desactivar()">Desactivar este aviso</a>';

jQuery(function(){
	// Comprobar el navegador
	if($.browser.msie){
		if(readCookie("aviso_ie")=="ok"){
		}else{
			$('body').prepend(message);
		}
	}
	// Comprobar que los vídeos estén bien
	if(location.href.indexOf("posting.php?mode=post&f=21")>0){
		document.getElementById("postform").setAttribute("onsubmit","return comprobarTitulo()");
	}
});