// Java Document
function MM_jumpMenu(selObj,restore){ //v3.0
  var obj = selObj.options[selObj.selectedIndex].value;
  window.location=obj;
  if (restore) selObj.selectedIndex=0;
}

function home_DoFSCommand(command, args) {
 if (command == "messagebox") {
 alert(args);
 }
}
// Ancla para Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub custserv1_FSCommand(ByVal command, ByVal args)\n');
	document.write('Call home_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

function cancelForm() {
   document.forms['postform'].action.value = "cancel";
   return true;
}

var chat_win = null;
var w = 480, h = 400;
if (document.all) {
   w = document.body.clientWidth; 
   h = document.body.clientHeight;
}
if (document.layers) { 
w = window.innerWidth; 
h = window.innerHeight; 
}
function openBrWindow(theURL,winName,features) {
  chat_win=window.open(theURL,winName,features);
  if (chat_win.moveTo) {
  chat_win.moveTo(w/2,h/2);
  }
}

function abrechat(){
if (chat_win && chat_win.open && !chat_win.closed){
chat_win.focus();
}else{
openBrWindow('programas/chat/intro.php?self=<?php echo $PHP_SELF;?>','chat','toolbar=no,scrollbars=no,scrollbars=0,width=550,height=400');
}
}

//Objeto ajax
function objajax() {
        try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {

                try {
                         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                         xmlhttp = false;
                }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp
}


//Funcion para votacion
function rating_not(val,id){
		_objeto=objajax()
        _target=document.getElementById('rating');
        _target.innerHTML="";
        _URL_="ajax/vote_rating_not.php?id=" + id + "&val=" + val;
        _objeto.open("GET",_URL_,true);	
        _objeto.onreadystatechange=function() {
                if (_objeto.readyState==1)
                {
            			document.body.style.cursor = "Wait";
						_target.innerHTML="<div id='cargando'><img src='css/img/ajax-loader.gif'></div>";
                }
                else if(_objeto.readyState==4)
                {
                         if(_objeto.status==200)
                         {
							     document.body.style.cursor = "Default";
                                 _target.innerHTML = _objeto.responseText; 
                         }
                }

        }
        _objeto.send(null);
}

function rating_cont(val,id){
		_objeto=objajax()
        _target=document.getElementById('rating');
        _target.innerHTML="";
        _URL_="ajax/vote_rating_cont.php?id=" + id + "&val=" + val;
        _objeto.open("GET",_URL_,true);	
        _objeto.onreadystatechange=function() {
                if (_objeto.readyState==1)
                {
            			document.body.style.cursor = "Wait";
						_target.innerHTML="<div id='cargando'><img src='css/img/ajax-loader.gif'></div>";
                }
                else if(_objeto.readyState==4)
                {
                         if(_objeto.status==200)
                         {
							     document.body.style.cursor = "Default";
                                 _target.innerHTML = _objeto.responseText; 
                         }
                }

        }
        _objeto.send(null);
}
