// JavaScript Document;
function tr(){
    alert("tr");
}
function check(e){
    if (e.stopPropagation) {
        e.stopPropagation();
    }else{
        if(window.event) {
            window.event.cancelBubble = true;
        }
    }
}

function autofitIframe(id){
    if (!window.opera && !document.mimeType && document.all && document.getElementById){
        parent.document.getElementById(id).style.height=this.document.body.offsetHeight+"px";
    }
    else if(document.getElementById) {
        parent.document.getElementById(id).style.height=this.document.body.scrollHeight+"px"
    }
}


function help_txt(txt){
    document.getElementById("info_msg").innerHTML = txt;
}

function bbcode(Which){ 
    document.addfrm.textDescription.value = document.addfrm.textDescription.value + Which;
} 
function MM_openBrWindow(theURL,winName,features) {
    window.open(theURL,winName,features);
}
function MM_jumpMenu(targ,selObj,restore){
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
}
function mouseIn(){
    document.getElementById("keyword").value="";
}
function mouseOut(){
    if(document.getElementById("keyword").value=="")
        document.getElementById("keyword").value="Búsqueda";
}
function activa(id){
    var opc=new Array("editorial","extra","about");
    for (var i=0;i<3;i++){
        var p="p_"+opc[i];
        document.getElementById(opc[i]).className="";
        document.getElementById(p).style.display="none";
    }
    p="p_"+id;
    document.getElementById(id).className="current";
    document.getElementById(p).style.display="block";
}
function altura(){
    al = new Array();
    max = 0;
    try{
        if(document.getElementById){
            for(i=0;i<arguments.length;i++){
                if(document.getElementById(arguments[i]))
                    al[i] = document.getElementById(arguments[i]).offsetHeight;
            }
            max = mayor(al);
            if(max > 0){
                for(i=0;i<arguments.length;i++){
                    if(document.getElementById(arguments[i]))
                        document.getElementById(arguments[i]).style.height = max + 'px';
                }
            }
        }
    }
    catch (exc) {
        alert("Se ha producido un error en la carga del CSS.");
        throw exc;
    }
}
function mayor(datos){  
    salida = 0;
    for(i=0;i<datos.length;i++){
        if(parseInt(datos[i]) > salida )
            salida = datos[i];
    }
    return salida;
}

function initEditor(){
    $( 'textarea.editor' ).ckeditor();
}
 
function submit_edit(){
    var editor_data = CKEDITOR.instances.textDescription.getData();
    xajax.$('textDescription').value = editor_data;
    xajax_profileSettings(xajax.getFormValues("addfrm"));
} 

function submit_sections(){
    var editor_data = CKEDITOR.instances.textDescription.getData();
    xajax.$('textDescription').value = editor_data;
    xajax_setSections(xajax.getFormValues("addfrm"));
}

function submit_settings(){
    var editor_data = CKEDITOR.instances.textDescription.getData();
    xajax.$('textDescription').value = editor_data;
    xajax_setSettings(xajax.getFormValues("addfrm"));
}

function submit_post(){
    var editor_data = CKEDITOR.instances.textDescription.getData();
    xajax.$('textDescription').value = editor_data;
    xajax_setPost(xajax.getFormValues("addfrm"));
} 
function submit_edic(){
    var editor_data = CKEDITOR.instances.textDescription.getData();
    xajax.$('textDescription').value = editor_data;
    xajax_euEdic(xajax.getFormValues("addfrm"));
} 
$(function () {
    $("#select_edic").change(function() {
        var val = $(this).val();
        if (val != '#') {
            location.href='/revista/intranet/boletin.php/'+val;
        }
    });
    if($('.coda-slider').length){
        $("body").removeClass("coda-slider-no-js");
        $(".coda-slider").children('.panel').hide().end().prepend('<p class="loading"><br /><img src="http://demo.mattiaviviani.com/wp_themes/synthetik/wp-content/themes/synthetik/images/ajax-loader.gif" alt="loading..." /></p>');
        $('#coda-slider-1').codaSlider();
    }
});
