<!--
var i=0;
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  start();
  startTime();
  //setTimeout("document.login_form.username.focus()",1);
  if (0<document.getElementsByName('login_form').length) {//check if login box available
  if (document.getElementById('login_password_box')) {
  document.getElementById('login_password_box').innerHTML=
    "<input name=\"login_password\" id=\"login_password\" class=\"login_password\" type=\"password\" value=\"\" onblur=\"removePwdField();\" />"+
	"<input name=\"temp_login_password\" id=\"temp_login_password\" class=\"login_password\" type=\"text\" value=\"Contraseña\" onfocus=\"addPwdField();\" />";
  }
  if (document.login_form) {
	if (document.login_form.login_password.value==''|document.login_form.login_password.value=='Contraseña'){ document.login_form.login_password.style.display="none"; }
  }
  if (document.getElementById('login_username')) {
	  if (document.getElementById('login_username').value=='') {document.getElementById('login_username').value="Usuario";}
	if (document.getElementById('login_username').value==''|document.getElementById('login_username').value=='Usuario'){ document.getElementById('login_username').value="Usuario"; }
  }
  }// end check if login box available

});


function addPwdField() {
  document.login_form.temp_login_password.style.display="none";
  document.login_form.login_password.style.display="";
  setTimeout("document.login_form.login_password.focus()",1);
}
function removePwdField() {
  if (document.login_form.login_password.value=='') {
  document.login_form.temp_login_password.style.display="";
  document.login_form.login_password.style.display="none";
  }
}
function start(){
  if( document.getElementById && document.getElementsByTagName ){
	  
//1  
    if( document.getElementById('tester') ){
      var testsubject = document.getElementById('tester');
        testsubject.onclick = function test(){
          document.getElementById('tester').innerHTML=document.getElementById('tester');	
      }
    }
//2
    if( document.getElementById('user_header') ){
		var user_header = document.getElementById('user_header');
	      user_header.onclick =
	function() {
			  
		 var el = document.getElementById('user_area');
	 	   if ( el.style.display != 'none' ) {
			el.style.display = 'none';
			document.getElementById('user_header').style.borderBottom = 'solid red 0px';
			//document.getElementById('triangle1').style.margin = '3px 2px 0 0';
		  
	 	   } 
	 	   else {
			el.style.display = '';
			document.getElementById('user_header').style.borderBottom = 'solid 1px #474747';
			//document.getElementById('triangle1').style.margin = '-28px 2px 0 0';
	 	   }
     }
	}
//3
	    if( document.getElementById('login_username') ){
          var affected_field = document.getElementById('login_username');
            affected_field.onfocus = function removeField() { if(affected_field.value=="Usuario") { affected_field.value=''; } 
			                                                }
	    	affected_field.onblur = function addField() { if(affected_field.value=='') { affected_field.value="Usuario"; } }
        }

		if( document.getElementById('search_field') ){
          var affected_field2 = document.getElementById('search_field');
            affected_field2.onfocus = function() { if(affected_field2.value=="BUSCAR EN NIGHTSMILE.COM...") { affected_field2.value=''; } }
	    	affected_field2.onblur = function() { if(affected_field2.value=='') { affected_field2.value="BUSCAR EN NIGHTSMILE.COM..."; } }
        }
		
		/*var amigoslist = getElementsByClassname("amigos_list")[0];
		amigoslist.innerHTML=amigoslist.innerHTML.split("").join("");*/
//4
/*
	if( document.getElementById('tester') ){
      var testsubject = document.getElementById('tester');
        testsubject.onclick = function(){
          document.getElementById('tester').innerHTML=document.getElementById('tester');	
      }
    }
//5
	if( document.getElementById('tester') ){
      var testsubject = document.getElementById('tester');
        testsubject.onclick = function(){
          document.getElementById('tester').innerHTML=document.getElementById('tester');	
      }
    }
//6
	if( document.getElementById('tester') ){
      var testsubject = document.getElementById('tester');
        testsubject.onclick = function(){
          document.getElementById('tester').innerHTML=document.getElementById('tester');	
      }
    }
//7*/
                     //Corrects Registration color

					 
if (document.getElementById('registration')){
var selects = document.getElementById('registration').getElementsByTagName("select");
var inputs = document.getElementById('registration').getElementsByTagName("input");
					 for(i=0; i<selects.length; i++){
	                     selects[i].onmouseout=selects[i].style.background="#000";
	                 }
					 for(i=0; i<inputs.length; i++){
	                     inputs[i].style.background="#000";
	                 }

}
					 //Corrects Registration color
					 
					 
  }
}
/*function Select(obj) {
	obj.style.border="solid #fff 1px";
	obj.style.background="#000";
	obj.onmouseover=function () {obj.style.border="solid #fff 1px";}
	obj.onmouseout=function () {obj.style.border="solid #fff 1px";}
}
function unSelect(obj) {
	obj.style.border="solid #474747 1px";
	obj.onmouseover=function () {obj.style.border="solid #fff 1px";obj.style.background="#333";}
	obj.onmouseout=function () {obj.style.border="solid #474747 1px";obj.style.background="#000";}
}
function Hover(obj) {
	obj.style.border="solid #fff 1px";
	obj.style.background="#333";
	obj.onmouseover=function () {obj.style.border="solid #fff 1px";obj.style.background="#333";}
	obj.onmouseout=function () {obj.style.border="solid #474747 1px";obj.style.background="#000";}
}*/
function text_field(obj) {
    //obj.style.background="#000";	
	obj.style.background="#222";
	obj.style.border="solid #fff 1px";
	obj.onmouseout = function() { obj.style.border="solid #555 1px"; obj.style.background="#000"; } 
	obj.onfocus = function() { obj.style.border="solid #fff 1px"; obj.style.background="#000"; 
	                           obj.onmouseout = function() { obj.style.border="solid #fff 1px"; obj.style.background="#000"; } 
							   obj.onmouseover = function() { obj.style.border="solid #fff 1px"; obj.style.background="#000"; }
							  } 
	obj.onblur = function() { obj.style.border="solid #555 1px"; obj.style.background="#000"; 
	                          obj.onmouseout = function() { obj.style.border="solid #555 1px"; obj.style.background="#000"; } 
							  obj.onmouseover = function() { obj.style.background="#222"; obj.style.border="solid #fff 1px"; }
	                        } 
}
function addtovid(video,user,url) {  	
	sendGetData("username="+user+"&video=video_"+video, url+"/videos/addtovid.html");
    document.getElementById('video_estoy').innerHTML='';
	if (document.getElementById('video_estan_users').innerHTML!=='') {
		document.getElementById('video_estan_users').innerHTML=document.getElementById('video_estan_users').innerHTML+', <a href="#">'+user+'</a>&nbsp;(<a class="removfromvid" href="'+url+"/videos/delfromvid.html?video="+video+"&user="+user+'">quitar</a>)';
	} else {
		document.getElementById('video_estan_users').innerHTML='<a href="#">'+user+'</a>';
	}
}
//  function send get data
function sendGetData(what,where) {
	var url = where;
	var reply;
function GetXmlHttpObject()
{
   var objXMLHttp=null
   if (window.XMLHttpRequest)
   {
      objXMLHttp=new XMLHttpRequest()
   }
   else if (window.ActiveXObject)
   {
      objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
   }
   return objXMLHttp
}
function stateChange() {
   	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
	  reply = xmlHttp.responseText;
     } else {reply = false;}
}
var xmlHttp=GetXmlHttpObject();
   if (xmlHttp==null)
   {
      alert ("Browser does not support HTTP Request")
      return
   }
   url = url+"?"+what;
   xmlHttp.onreadystatechange=stateChange
   xmlHttp.open("GET",url,true)
   xmlHttp.send(null)
   //alert(url);
   return reply;
}



// /function send get data
//-->
