﻿
function Maximizar() {
    try {
        var minY = 0;
        maxHeight = screen.availHeight - minY
        var width = 1024;
        if (screen.availWidth < width)
            width = screen.availWidth;
        var height = 2000;
        if (maxHeight < height)
            height = maxHeight;
       // var x = (screen.availWidth - width) / 2;
        var x = (screen.availWidth - width); //+10;
        var y = (maxHeight - height) / 2 + minY;
        if (x < 0)
            x = 0;
        if (y < 0)
            y = minY;
        
		if (document.all) {
		    top.window.resizeTo(width+20, height+20);
		}
		else if (document.layers || document.getElementById) {
		if (top.window.outerHeight < height || top.window.outerWidth < width) {
		    top.window.outerHeight = height;
		    top.window.outerWidth = width;	}
		}
		window.moveTo(x,y);
	}
	catch(err){}
}

function PopResize(width,height) {
    try {
        window.moveTo(screen.availWidth / 2 - width / 2, screen.availHeight / 2 - height / 2);
        var ww = top.window.width - document.body.clientWidth;
        var hh = top.window.height - document.body.clientHeight;
        width = width+ww;
        height = height+hh;
        if (document.all) {
            top.window.resizeTo(width, height);
           // document.body.clientWidth=width;
           // document.body.clientHeight = height;
        }        
        else if (document.layers || document.getElementById) {
        if (top.window.outerHeight < height || top.window.outerWidth < width) {
            top.window.outerHeight = height;
            top.window.outerWidth = width;
            }
        }        
    }
    catch (err) { }
}

function setFilter1() {

}

function setFilter2() {
}

function setFilteredStations() {
}


function setMyHomePage(url) {    
    if (document.all) {
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage(url);
    }
    /*
    else if (window.sidebar) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                alert("Entra al menú Herramientas-Opciones y escribe la siguiente página de inicio....   http://www.ESCUCHEMOS.com/home");
            }
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage', url);
    } 
    */
    else
        alert("Entra al menú Herramientas-Opciones y escribe la siguiente página de inicio....   http://www.ESCUCHEMOS.com/home");
    window.location.href="http://www.ESCUCHEMOS.com/home/new";
}




/*
* Prompts the user to grant a permission to the application.
*/
var NoHaPreguntado = true;
function ltfb_facebook_prompt_permission(permission, callbackFunc) {
    //        ensure_init(function() {
    //check is user already granted for this permission or not
    FB.Facebook.apiClient.users_hasAppPermission(permission,
     function(result) {
         // prompt offline permission
         if (result == 0) {
             // render the permission dialog
             if (NoHaPreguntado) {
                 NoHaPreguntado = false;
                 FB.Connect.showPermissionDialog(permission, callbackFunc);
             }
         } else {
             // permission already granted.
             callbackFunc(true);
         }
     });
    //        });
 }


function ltfb_streamPublish(user_message, attachment, action_links, target_id, user_message_prompt, callback) {    
    ltfb_facebook_prompt_permission('publish_stream', function(accepted) {
        if (accepted) {
            FB.Connect.streamPublish(user_message, attachment, action_links, target_id, user_message_prompt, callback, true);
        }
    });
}

var isInSession = false;
function ltfb_Publish(st_params) {
    var fb_msg = ' Si quieres saber qué música estoy escuchando, dale click al siguiente link: http://www.ESCUCHEMOS.com/#streaming?' +
                  st_params + '&ref=/facebook/escuchando';
    var fb_actionLinks = [{ 'text': 'Sintonizar misma emisora', 'href': 'http://www.ESCUCHEMOS.com/#streaming?' +
                  st_params + '&ref=/facebook/misma-emisora'}];
    //   ltfb_streamPublish (user_message string, attachment, action_links, target_id, user_message_prompt, callback)   -->
//    if (isInSession)
    ltfb_streamPublish(fb_msg, '', fb_actionLinks, null, null, null);
}


/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox



