function show_div(object) {
if (document.getElementById) { 
document.getElementById(object).style.display = 'inline';
document.getElementById(object).style.visibility = 'visible';}
else {if (document.layers) { document.object.display = 'inline';document.object.visibility = 'visible';}
else {document.all.object.style.display = 'inline';document.all.object.style.visibility = 'visible';}
}
}

function hide_div(object) {
if (document.getElementById) {
document.getElementById(object).style.display = 'none';}
else {if (document.layers) {document.object.display = 'none';}
else {document.all.object.style.display = 'none';}
}
}

//----------------------------------------------------------------
function estaVacio(s,texto){
	var len = s.value.length;
	for (i=0;i<len;++i){
		if (s.value.charAt(i)!=" ") {return false;}
	}
	alert(texto); s.focus();
	return true;
}
//----------------------------------------------------------------
function trimJS(cadena) { cadena.value = cadena.value.replace(/^\s*|\s*$/g,""); }
//----------------------------------------------------------------
function validaEmail(emails) {
	trimJS(emails);
	emails.value = emails.value.toLowerCase();
	email = new String(emails.value);
	if(email == "" || email.indexOf("@", 0) == -1 || email.indexOf(".", 0) == -1 || email.length <= 9) {
		alert("It is not a valid email.");
		emails.focus();
		return false;
	} else {
		var ok = 1;
		var validos = "abcdefghijklmnopqrstuvwxyz0123456789-_@.";
		for (i=0;i<email.length;i++) {
			if (validos.indexOf(email.charAt(i)) == "-1") { ok = 0; }
		}
		if (ok == 0) {
			alert("It is not a valid email.");
			emails.focus();
			return false;
		}
	}
	return true;
}
function validaNews(){if(validaEmail(document.news.email))return true;return false}
function validaComments(){if(!validaEmail(document.comments.email))return false;
if(!estaVacio(document.comments.message, "Please enter your comments."))return true;
return false}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function setCheck(obj, sIDInput){
if (obj.checked){
	obj.firstChild.innerHTML = ""
}else{
	obj.checked = false; //Initiate value with false;
	obj.firstChild.innerHTML = "X"
}
obj.document.getElementById(sIDInput).value = obj.checked;
obj.checked =!obj.checked;
}


function widthWindow() {
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {//Non-IE
	myWidth = window.innerWidth-17;
    myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
}
return myWidth;
}

function rePosition(im,l){document.getElementById(im).style.left = (Math.round((widthWindow()-880)/2)+l)+'px';}

function linkMail(adr, dom) {
	arr_dom=dom.split(".");
	domstr=arr_dom[0];
	for (i=1; arr_dom[i]!=null; i++) {
		domstr=domstr+" [dot] "+arr_dom[i];
	}
	document.write("<a href=\"click to send\" onClick=\"writeMail(this, \'"+adr+"\', \'"+dom+"\')\">"+adr+" [at] "+domstr+"</a>")
}
function writeMail(ref, adr, dom) {
	ref.href="mailto:"+adr+"@"+dom;
}