/* ****************************************************************** */
/* **** Funciones para validar la cookie de votacion del usuario **** */
/* **** 17/06/2008 - CSA ******************************************** */
/* ****************************************************************** */

// ------------------------------------------------------------------
function hide_confirmacion_link() {
  div_conf = document.getElementById("myDivLink");
  if(div_conf) {
    div_conf.style.display="none";
  }
}

// ------------------------------------------------------------------
function show_confirmacion_link() {
  div_conf = document.getElementById("myDivLink");
  if(div_conf) {
    if ( div_conf.style.display == "none" ){
        div_conf.style.display="";
        document.getElementById('input_link').value=document.URL;
        document.getElementById('input_link').focus();
        document.getElementById('input_link').select();

        //Mueve div de acuerdo a browser y resolucion.
        if ( (navigator.appName == "Netscape") || (navigator.appName == "Microsoft Internet Explorer") ) {
            if (parseInt(navigator.appVersion) >= 5) {
                //FF.
                if ( screen.availWidth == 1024 ){
                    document.getElementById("myDivLink").style.left="90px";
                    document.getElementById("myDivLink").style.top="218px";
                } else {
                    if ( screen.availWidth == 1280 ){
                        document.getElementById("myDivLink").style.left="230px";
                        document.getElementById("myDivLink").style.top="218px";
                    } else {
                        document.getElementById("myDivLink").style.left="95px";
                        document.getElementById("myDivLink").style.top="223px";
                    };
                };
            } else {
                //IE.
                if ( screen.availWidth == 1024 ){
                    document.getElementById("myDivLink").style.left="88px";
                    document.getElementById("myDivLink").style.top="190px";
                } else {
                    if ( screen.availWidth == 1280 ) {
                        document.getElementById("myDivLink").style.left="200px";
                        document.getElementById("myDivLink").style.top="190px";
                    } else {
                        document.getElementById("myDivLink").style.left="100px";
                        document.getElementById("myDivLink").style.top="58px";
                    };
                };
             };
        } else {
                if ( screen.availWidth == 1024 ){
                    document.getElementById("myDivLink").style.left="180px";
                    document.getElementById("myDivLink").style.top="228px";
                } else {
                    document.getElementById("myDivLink").style.left="230px";
                    document.getElementById("myDivLink").style.top="228px";;
                };
        };


    }else{
        div_conf.style.display="none";
    };
  };
};


  // ------------------------------------------------------------------
function hide_confirmacion_embed() {
  div_conf = document.getElementById("myDivEmbed");
  if(div_conf) {
    div_conf.style.display="none";
  }
}

// ------------------------------------------------------------------
function show_confirmacion_embed(titular, bajada) {  
  //Los apostrofes vienen convertidos en |, por lo que se cambia "|" por "`".
  var tmp_titular = titular;
  tmp_titular = tmp_titular.replace(/\|/g,"`");
  var tmp_bajada = bajada;
  tmp_bajada = tmp_bajada.replace(/\|/g,"`");
  
  var html_embed = '';
  var url_embed  = '';
  var servidor = 'http://'+location.hostname;
  div_conf = document.getElementById("myDivEmbed");
  if(div_conf) {
    if ( div_conf.style.display == "none" ){
        div_conf.style.display='inline';
        url_embed = document.URL;
        html_embed  = '<div class="">';
        html_embed += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
        html_embed += '<tr>	<td align="left" colspan="2"><a href="http://www.cooperativa.cl" class="tdd_hora" target="_blank"><img src="'+servidor+'/prontus_nots/imag/head/logo.gif" width="295" height="100" border="0"></a></td></tr></table>';

        html_embed += '<span class="titular"><a href="'+url_embed+'" target="_blank" title="Ir a la nota en COOPERATIVA.cl" style="font-family:Arial,Verdana,Tahoma,sans-serif; font-size: 25px; font-weight: bold; color: #003366; text-align: left; text-decoration: none;">'+tmp_titular+' </a></span>';
        html_embed += '<p style="font-family:Arial,Verdana,Tahoma,sans-serif; font-size: 16px;color: #003366; text-align: left;">'+tmp_bajada+'</p>';
        html_embed += '<div><span><a href="http://www.cooperativa.cl" style="font-family:Arial,Verdana,Tahoma,sans-serif; font-size: 10px; color: #cc6700;text-decoration: none;" target="_blank"><b>Cooperativa.cl</b></a>&nbsp;</span></div>';
        document.getElementById('input_embed').value=html_embed;
        document.getElementById('input_embed').focus();
        document.getElementById('input_embed').select();
        //Mueve div de acuerdo a browser y resolucion.
        if ( (navigator.appName == "Netscape") || (navigator.appName == "Microsoft Internet Explorer") ) {
            if (parseInt(navigator.appVersion) >= 5) {
                //FF.
                if ( screen.availWidth == 1024 ){
                    document.getElementById("myDivEmbed").style.left="90px";
                    document.getElementById("myDivEmbed").style.top="218px";
                } else {
                    if ( screen.availWidth == 1280 ){
                        document.getElementById("myDivEmbed").style.left="230px";
                        document.getElementById("myDivEmbed").style.top="218px";                        
                    } else {
                        document.getElementById("myDivEmbed").style.left="95px";
                        document.getElementById("myDivEmbed").style.top="223px";
                    };
                };
            } else {
                //IE.
                if ( screen.availWidth == 1024 ){
                    document.getElementById("myDivEmbed").style.left="88px";
                    document.getElementById("myDivEmbed").style.top="190px";
                } else {
                    if ( screen.availWidth == 1280 ) {
                        document.getElementById("myDivEmbed").style.left="200px";
                        document.getElementById("myDivEmbed").style.top="190px";
                    } else {
                        document.getElementById("myDivEmbed").style.left="100px";
                        document.getElementById("myDivEmbed").style.top="54px";
                    };
                };
             };
        } else {
                if ( screen.availWidth == 1024 ){
                    document.getElementById("myDivEmbed").style.left="180px";
                    document.getElementById("myDivEmbed").style.top="228px";
                } else {
                    document.getElementById("myDivEmbed").style.left="230px";
                    document.getElementById("myDivEmbed").style.top="228px";;
                };
        };
    }else{
        div_conf.style.display="none";
    };
  };
}

//---------------------------------------------------------------------
function crea_div (){
    var scriptText='<div id="myDivLink" class="myDivLink" style="display:none;"><br>';
    var textoEmbed = 'Copie este código (Ctrl+C) e insértelo en su página web para publicar este contenido en ella.';
    var textoLink = 'Copie esta dirección (Ctrl+C). A través de ella tendrá acceso directo a este contenido.';
    scriptText+= '<table border="0" width="100%" cellspacing="5" cellpadding="5"><tr><td width="80%" class="link_text_tit">Ver noticia en su browser</td><td width="20%" align="right"><a href="javascript:hide_confirmacion_link();"><img src="/prontus_nots/imag/auxi/cerrar_pop.gif" border="0"></a></td></tr>';
    scriptText+='<tr><td colspan="2" class="link_text_body"></td></tr>';
    scriptText+= '<tr><td colspan="2" class="link_text_body">' + textoLink + '</td></tr>';
    scriptText+='<tr><td colspan="2" class="link_text_body"></td></tr>'
    scriptText+='<tr><td colspan="2" align="left"><textarea name="input_link" rows="11" cols="52" wrap="VIRTUAL" id="input_link" class="link_textarea" readonly></textarea><br></td></tr></table>';
    scriptText+='</div>';

    scriptText+='<div id="myDivEmbed" class="myDivEmbed" style="display:none;"><br>';
    scriptText+= '<table border="0" width="100%" cellspacing="5" cellpadding="5"><tr><td width="80%" class="embed_text_tit">Publicar en su sitio</td><td width="20%" align="right"><a href="javascript:hide_confirmacion_embed();"><img src="/prontus_nots/imag/auxi/cerrar_pop.gif" border="0"></a></td></tr>';
    scriptText+='<tr><td colspan="2" class="embed_text_body"></td></tr>'
    scriptText+='<tr><td colspan="2" class="embed_text_body">' + textoEmbed + '</td></tr>'
    scriptText+='<tr><td colspan="2" class="embed_text_body"></td></tr>'
    scriptText+='<tr><td colspan="2" align="left"><textarea name="input_embed" rows="11" cols="52" wrap="VIRTUAL" id="input_embed" class="embed_textarea" readonly></textarea><br></td></tr></table>';
    scriptText+='</div>';
    document.write(scriptText);
};

