// no mouse right button...
document.oncontextmenu = function(){return false}
 
// disable select option...
// function disableselect(e){
//    return false
//    }

function reEnable(){
   return true
   }
 
// document.onselectstart=new Function ("return false")

if (window.sidebar){
   document.onmousedown=disableselect
   document.onclick=reEnable
   }

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

/*
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
*/

function meGoes(URL){
	window.open(URL,"_self","");
}
			
function cDate() {
// checks date on the client and returns it in dd/mm/yyyy format
	var cToday = new Date();
	var cDay = cToday.getDate();
	var cMonth = cToday.getMonth();
	cMonth++;
	var cYear = cToday.getYear();

	if (navigator.appName=="Netscape") {
	cYear = 1900 + cYear
	}
	if (cMonth < 10) {
	cMonth = "0" + cMonth;
	}
	if (cDay < 10) {
	cDay = "0" + cDay;
	}
	return (cDay + "/" + cMonth + "/" + cYear);
}

function cHour() {
// returns time on the client in format hh:mm
	var cNow = new Date();
    var cHour = cNow.getHours();
    if (cHour < 10) {
        cHour = "0" + cHour;
    }
    var cMinute = cNow.getMinutes();
    if (cMinute < 10) {
        cMinute = "0" + cMinute;
    }
    return (cHour + ":" + cMinute);
}
function writeTag(form,element,tag) {
// inserts a tag in the textarea
// tested on IE Win only
    var posto = eval("document." + form + "." + element);
    posto.focus();
    document.selection.createRange().text += tag;
    return;
}

function formatStr (v) {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    document.selection.createRange().text = '<' + v + '>' + str + '</' + v + '>';
}

function FontTipo (v) {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    document.selection.createRange().text = '<font face="' + v + '">' + str + '</font>';
}

function FontSize (v) {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    document.selection.createRange().text = '<font size="' + v + '">' + str + '</font>';
}

function ColorTexto (v) {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    document.selection.createRange().text = '<font color="#' + v + '">' + str + '</font>';
}

function ColorFondo (v) {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    document.selection.createRange().text = '<span style="background-color: #' + v + '">' + str + '</span>';
}

function InsertAlign (v) {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    document.selection.createRange().text = '<p align="' + v + '">' + str + '</p>';
}

function insertBreak (v) {
    var str = document.editForm.text.value;
    str =  document.editForm.text.value + "<"+v+">"
    document.editForm.text.value=str;
}

function insertImage () {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    var my_link = prompt('Ingrese URL de imagen:', 'http://');
    document.selection.createRange().text = "<img src='" + my_link + "'>";
}

function insertLink (marco) {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    var my_link = prompt('Ingrese URL:', 'http://');
    if (my_link != null)
        document.selection.createRange().text = '<a target="' + marco + '" href="' + my_link + '">' + str + '</a>';
}

function ConvertCR(input) {
   var output = "";
   for (var i = 0; i < input.length; i++) {
      if ((input.charCodeAt(i) == 13) && (input.charCodeAt(i + 1) == 10)) {
         i++;
         output += "<BR>";
      } else {
         output += input.charAt(i);
      }
   }
   document.editForm.text.value = output;
}

