/********************************************

 ** ESPACIO.YA.COM v2.0 **

    $Revision: 1.26 $

    Last update: $Date: 2008/04/04 08:48:55 $

	(c) Ya.com Internet Factory, S.A.U.

	T-Online International AG Group

********************************************/



/* publicity */

function paint_ZoneXPub(){
bannerWoo.begin({pos:1,wid:468,hei:60});
bannerWoo.end();
}



function paint_pub1(){
bannerWoo.begin({pos:1,wid:468,hei:60});
bannerWoo.end();
}



function paint_pub2(){
bannerWoo.begin({pos:3,wid:200,hei:200});
bannerWoo.end();
}

function paint_chechkm8(){

var chechkm8inactive=false;

//var cm8cat= checkM8Code;//'espacio.home'

if (!chechkm8inactive) { 

document.write('<SCR'+'IPT language="javascript" src="http://ad.ya.com/multiplescript/checkm8_init_1.js"></SC'+'RIPT>');

}

}

/* end publicity */

function doOnKeyPress(e, func) {

if (window.event.keyCode == 13) {

return eval(func);

}

return false;

}

/* Tricks & Advice  functions */

function selectCode(id) {

var copied = false;

var obj = document.getElementById(id);

obj.focus();

obj.select();

if (window.clipboardData) { //Only for MSIE

copied = window.clipboardData.setData("Text",obj.value);

}

}

/* end Tricks & Advice  functions */



/* File Administrator functions */

function CreateDir(f, idtonav) {

f.M.value = 'admindir1';

f.CD.value = idtonav;

f.AC.value = 1;

f.submit();

}

function RenameDir(f, type) {

var idtonav = SelectId(f, type);

if (idtonav=='') return false;

f.M.value = 'admindir1';

f.CD.value = idtonav;

f.AC.value = 2;

f.submit();

}

function DeleteDir(f, type) {

var a = 0;

var len = f.elements.length;

var idtonav = "";

for (var i = 0; i < len; i++) {

var e = f.elements[i];

if ((e.name == "checkfile") && (e.checked == true) && (e.value.indexOf(type) > 0)) {

if (idtonav=="") {

idtonav = e.value.substring (0, e.value.indexOf(type))

} else {

idtonav = idtonav + ',' + e.value.substring (0, e.value.indexOf(type))

}

}

}

if (idtonav=='') return false;

f.M.value = 'admindir1';

f.CD.value = idtonav;

f.AC.value = 3;

f.submit();

}

function OpenDir(f, type) {

var idtonav = SelectId(f, type);

if (idtonav=='') return false;

f.M.value = 'adminhome';

f.CD.value = idtonav;

f.submit();

}

function OpenDirSelect(f) {

f.M.value = 'adminhome';

f.CD.value = f.CDOP.value;

f.submit();

}				

function CloseDir(f, idtonav) {  

f.M.value = 'adminhome';

f.CD.value = idtonav;

f.submit();

}

function DoReloadOrder(order, idtonav, f) {    

f.M.value = 'adminhome';

f.CD.value = idtonav;

f.OD.value = order;

f.submit();

}

function DoReload(f) {    

f.M.value = 'adminhome';

f.submit();

}

function SelectId (f, type) {

var a = 0;

var len = f.elements.length;

var idtonav = "";

for (var i = 0; i < len; i++) {

var e = f.elements[i];

if ((e.name == "checkfile")&&(e.checked==true)&&(e.value.indexOf(type)>0)) {

a++;

}

}

if (a==0) {

if (type == 'file') {

alert('Debes seleccionar un archivo');

} else if (type == 'directory') {

alert('Debes seleccionar un directorio');

} else {

alert('No hay elmentos seleccionados');

}

return '';

} else if (a>1) {

alert('Sólo puede haber un elemento seleccionado');

return '';

} else {

for (var i = 0; i < len; i++) {

var e = f.elements[i];

if ((e.name == "checkfile")&&(e.checked==true)&&(e.value.indexOf(type)>0)) {

idtonav = e.value.substring (0, e.value.indexOf(type))

}

}

}

return (idtonav);

}

function DeselectAll() {

f = document.forms['filelist'];

var len = f.elements.length;

for (var i = 0; i < len; i++) {

var e = f.elements[i];

if (e.name == "checkfile") {

e.checked = false;

}

}

}

function SelectAll() {

f = document.forms['filelist'];

var len = f.elements.length;

for (var i = 0; i < len; i++) {

var e = f.elements[i];

if (e.name == "checkfile") {

e.checked = true;

}

}

}

function CopyFile(f, type) {

var a = 0;

var len = f.elements.length;

var idtonav = "";

for (var i = 0; i < len; i++) {

var e = f.elements[i];

if ((e.name == "checkfile")&&(e.checked==true)&&(e.value.indexOf(type)>0)) {

if (idtonav=="") {

idtonav = e.value.substring (0, e.value.indexOf(type))

} else {

idtonav = idtonav + ',' + e.value.substring (0, e.value.indexOf(type))

}

}

}

if (idtonav=='') return false;

f.M.value = 'adminfile1';

f.CD.value = idtonav;

f.AC.value = 1;

f.submit();

}

function DeleteFile(f, type) {

var a = 0;

var len = f.elements.length;

var idtonav = "";

for (var i = 0; i < len; i++) {

var e = f.elements[i];

if ((e.name == "checkfile")&&(e.checked==true)&&(e.value.indexOf(type)>0)) {

if (idtonav=="") {

idtonav = e.value.substring (0, e.value.indexOf(type))

} else {

idtonav = idtonav + ',' + e.value.substring (0, e.value.indexOf(type))

}

}

}

if (idtonav=='') return false;

f.M.value = 'adminfile1';

f.CD.value = idtonav;

f.AC.value = 3;

f.submit();

}

function ViewFile(f, type) {

var frm = document.forms['goto'];

var idtonav = SelectId(f, type)

if (idtonav=='') return false;

frm.action = f.URI.value + '/' + idtonav;

frm.rnd.value = new Date().getTime();

frm.submit();

}



function RenameFile(f, type) {

var idtonav = SelectId(f, type);

if (idtonav=='') return false;

f.M.value = 'adminfile1';

f.CD.value = idtonav;

f.AC.value = 4;

f.submit();

}



function EditFile(f, type) {

var idtonav = SelectId(f, type);

if (idtonav=='') return false;

f.M.value = 'adminedit1';

f.CD.value = idtonav;

f.submit();

}



function MoveFile(f, type) {

var a = 0;

var len = f.elements.length;

var idtonav = "";

for (var i = 0; i < len; i++) {

var e = f.elements[i];

if ((e.name == "checkfile")&&(e.checked==true)&&(e.value.indexOf(type)>0)) {

if (idtonav=="") {

idtonav = e.value.substring (0, e.value.indexOf(type))

} else {

idtonav = idtonav + ',' + e.value.substring (0, e.value.indexOf(type))

}

}

}

if (idtonav=='') return false;

f.M.value = 'adminfile1';

f.CD.value = idtonav;

f.AC.value = 2;

f.submit();

}

/* end File Administrator functions */



var mac = false;

if (navigator.appVersion.toLowerCase().indexOf("mac") != -1) {

mac = true;

}



function Trim(s)

{

  if (s==null) return null;

  var r = s;

  while (r.length>0 && (r.charAt(0)==' '||r.charAt(0)=='\r'||r.charAt(0)=='\n'||r.charAt(0)=='\t')) {

    r = r.substring(1, r.length);

  }

  while (r.length>0 && (r.charAt(r.length-1)==' '||r.charAt(r.length-1)=='\r'||r.charAt(r.length-1)=='\n'||r.charAt(r.length-1)=='\t')) {

    r = r.substring(0, r.length-1);

  }

  return r;

}



function disconnectSpace(){

  var cookies = document.cookie.split(";");

  if (cookies!=null) {

    var length = cookies.length;

    if (length>0) {

      var pos;

      for(var i=0; i<length; i++) {

        pos = cookies[i].indexOf("=");

        if (pos!=-1) {

          CookieDelete(Trim(cookies[i].substring(0, pos)));

		}  

      }

    }

  }

  window.location.reload(true);

}



function ComprobarCaracteres(cadena) {

var caracteres = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.@"; for(i=0;i<cadena.length;i++) { if (caracteres.indexOf(cadena.charAt(i)) == -1) return false; } return true;

}





function ConectarVentana(formulario) { 



	var f;

	f = document.forms["FORMPRINCIPA"];

	var host = "validacion.ya.com";    

	f.URL_VOLVER.value = window.location.href;

	if (f.URL_VOLVER_ERROR != null) {

		if (f.URL_VOLVER_ERROR.value == "")

			f.URL_VOLVER_ERROR.value = window.location.href;

	}

	if(window.location.href.indexOf("chueca")>0){        

		f.SITE.value = "chueca";

	}else{

		f.SITE.value = "ya";

	}    

	f.action = "http://" + host + "/SConnectWindowNoPopup";

	f.submit();		



}

  

function DesconectarVentana(formulario) { 



	var f;

	f = document.forms["FORMDESCONECTA"];

	var host = "validacion.ya.com";    

	f.URL_VOLVER.value = window.location.href;

	if (f.URL_VOLVER_ERROR != null) {

		if (f.URL_VOLVER_ERROR.value == "")

			f.URL_VOLVER_ERROR.value = window.location.href;

	}

	if(window.location.href.indexOf("chueca")>0){        

		f.SITE.value = "chueca";

	}else{

		f.SITE.value = "ya";

	}    

	f.action = "http://" + host + "/SDisconnectWindowNoPopup";

	f.submit();	



}







function Modify(option, extra) {

	f = document.forms['MODIFYPAGE'];



	var aInitValue = new Array('<p>','','<b>','<i>','<u>','<font color="'+extra+'">','<a href="'+extra+'">','<img src=""/>');

	var aEndValue = new Array('</p>','<br/>','</b>','</i>','</u>','</font>','</a>','');

	//IE support

	if (document.selection) {

		f.FILECONTENT.focus();

		sel = document.selection.createRange();

		sel.text = aInitValue[option] + sel.text + aEndValue[option];

	}  

	//MOZILLA/NETSCAPE support

	else if (f.FILECONTENT.selectionStart || f.FILECONTENT.selectionStart == '0') {

		var startPos = f.FILECONTENT.selectionStart;

		var endPos = f.FILECONTENT.selectionEnd;

		f.FILECONTENT.value = f.FILECONTENT.value.substring(0, startPos) + aInitValue[option] + f.FILECONTENT.value.substring(startPos, endPos) + aEndValue[option] + f.FILECONTENT.value.substring(endPos, f.FILECONTENT.value.length);

		f.FILECONTENT.selectionStart = startPos + aInitValue[option].length;

		f.FILECONTENT.selectionEnd = startPos + aInitValue[option].length + (endPos-startPos);

	}

}



function GoAction (f, option) {

	if (option==0) {

		f.target = "_blank";

	} else {

		f.target = "_self";

	}

	f.OPTION.value = option;

	f.submit();

}



function GoReturn(f) {

	f.M.value="adminhome";

	f.submit();

}





