//var HOST = 'http://86.126.63.78/divinenine/';
var HOST = 'http://www.divinenine.net/';

function redir() {
	window.location.href = "/logout";
}

function nextauthor(nav)
{
	var rand = Math.random();
	 var anx =document.getElementById('anx').value;
	 var apr =document.getElementById('apr').value;
	if(nav=="anex")
     {
          var x = parseInt(anx) + 1;
		  document.getElementById('anx').value = x;
		  document.getElementById('apr').value = x;
		
    
	 }
	if(nav=="aprev")
	{
		   var y =  parseInt(apr) - 1;
		   document.getElementById('apr').value = y;
		   document.getElementById('anx').value = y;
     
      }
	
var xmlHttp;
try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
	if(xmlHttp.readyState < 4)
      {
	  document.getElementById('replaceauthor').innerHTML = "<center><img src='images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
	  document.getElementById('replaceauthor').innerHTML=xmlHttp.responseText;
      }
    }
	if(nav=="anex")
  xmlHttp.open("GET","request.featured.author.php?anex="+x+"&rand="+rand,true);
  if(nav=="aprev")
  xmlHttp.open("GET","request.featured.author.php?anex="+y+"&rand="+rand,true);
  xmlHttp.send(null);  
  }

  
  
  
  
  
  
  
  
  function nextfamous(nav)
{
	var rand = Math.random();
	 var nx =document.getElementById('nx').value;
	 var pr =document.getElementById('pr').value;
	if(nav=="nex")
     {
          var x = parseInt(nx) + 1;
		  document.getElementById('nx').value = x;
		  document.getElementById('pr').value = x;
		
    
	 }
	if(nav=="prev")
	{
		   var y =  parseInt(pr) - 1;
		   document.getElementById('pr').value = y;
		   document.getElementById('nx').value = y;
     
      }
	
var xmlHttp;
try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('replacefamous').innerHTML = "<center><img src='images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
   
	  document.getElementById('replacefamous').innerHTML=xmlHttp.responseText;
      }
    }
	if(nav=="nex")
  xmlHttp.open("GET","request.featured.famous.php?nex="+x+"&rand="+rand,true);
  if(nav=="prev")
  xmlHttp.open("GET","request.featured.famous.php?nex="+y+"&rand="+rand,true);
  xmlHttp.send(null);  
  }
  
  
    function nextfamousdetail(nav,orgid)
{
	var rand = Math.random();
	
	 var dnx = document.getElementById('dnx').value;
	 var dpr =document.getElementById('dpr').value;
	if(nav=="nex")
     {
          var x = parseInt(dnx) + 1;
		  document.getElementById('dnx').value = x;
		  document.getElementById('dpr').value = x;
		
    
	 }
	if(nav=="prev")
	{
		   var y =  parseInt(dpr) - 1;
		   document.getElementById('dpr').value = y;
		   document.getElementById('dnx').value = y;
     
      }
	
var xmlHttp;
try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('detailreplace').innerHTML = "<center><img src='images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
   
	  document.getElementById('detailreplace').innerHTML=xmlHttp.responseText;
      }
    }
	if(nav=="nex")
  xmlHttp.open("GET","detailreplace.php?nex="+x+"&orgid="+orgid+"&rand="+rand,true);
  if(nav=="prev")
  xmlHttp.open("GET","detailreplace.php?nex="+y+"&orgid="+orgid+"&rand="+rand,true);
  xmlHttp.send(null);  
  }
  
   function nextnews(nav)
  {
	  var rand = Math.random();
	  var nxt = parseInt(nav)
	  document.getElementById('hiddennews').value = nxt;
	  /*document.getElementById('hiddenprv').value = nxt - 1;*/
	switch(nav)
	{
		case '1':
    	document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('1')>Alpha Phi Alpha</a>";
			document.getElementById('one').src = HOST + "images/one-on.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case '2':
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('2')>Alpha Kappa Alpha</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two-on.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case '3':
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('3')>Kappa Alpha Psi</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three-on.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case '4':
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('4')>Omega Psi Phi</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four-on.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case '5':
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('5')>Delta Sigma Theta</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five-on.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case '6':
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('6')>Phi Beta Sigma</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six-on.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case '7':
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('7')>Zeta Phi Beta";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven-on.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case '8':
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('8')>Sigm Gamma Rho";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight-on.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case '9':
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('9')>Iota Phi Theta";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine-on.gif";
    		break;
    	default:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('1')>Alpha Phi Alpha";
			document.getElementById('one').src = HOST + "images/one-on.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
	}
   var xmlHttp;
  try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('replace').innerHTML = "<center><img src='" + HOST + "images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
    
	  document.getElementById('replace').innerHTML=xmlHttp.responseText;
      }
    }
  xmlHttp.open("GET",HOST + "request.news.latest.php?feedid="+nav+"&rand="+rand,true);
  xmlHttp.send(null);  
  }
  
  
  function shownews(id)
  {
	  var rand = Math.random();
   var xmlHttp;
  try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('newsdisplay').innerHTML = "<center><img src='images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
    
	  document.getElementById('newsdisplay').innerHTML=xmlHttp.responseText;
      }
    }
  xmlHttp.open("GET","request.news.feed.php?id="+id,true);
  xmlHttp.send(null);  
  }
  
  
  
   function showarticle(id,org)
  {
	  var rand = Math.random();
   var xmlHttp;
  try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");  
	 
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('newsdisplay').innerHTML = "<center><img src='images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
    
	  document.getElementById('newsdisplay').innerHTML=xmlHttp.responseText;
      }
    }
  xmlHttp.open("GET","request.news.article.php?id="+id+"&rand="+rand+"&org="+org,true);
  xmlHttp.send(null);  
  }
  
  
  function popup(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=1000,height=1000,left = 12,top = -116');");
}


 function submitcomment(id)
  {
	  var rand = Math.random();
	  if(document.getElementById('cname').value=='')
	  {
	  alert("Please Enter Your Name");
	  return false;
	  }
	  else
	  var name = document.getElementById('cname').value;
	  
	   if(document.getElementById('cemail').value=='')
	   {
	  alert("Please Enter Your Email");
	   return false;
	   }
	  else
	  var email = document.getElementById('cemail').value;
	 
	   if(document.getElementById('ctext').value=='')
	   {
	   alert("Please Enter Your Comment");
	    return false;
	  }
	  else
	  var comment = document.getElementById('ctext').value;
	  var site = document.getElementById('csite').value;
   var xmlHttp;
  try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('commentdiv').innerHTML = "<center><img src='images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
	  document.getElementById('commentdiv').innerHTML=xmlHttp.responseText;
      }
    }
  xmlHttp.open("GET","submitcomment.php?id="+id+"&name="+name+"&email="+email+"&site="+site+"&comment="+comment+"&rand="+rand,true);
  xmlHttp.send(null);  
  }
  
  function validationfamous()
  {
	 
	 if(document.getElementById('name').value=='' || document.getElementById('name').value=='Name Here')
	  {
		  alert('Please Enter Name');
		  document.getElementById('name').focus();
		  return false;
	  }
	    if(document.getElementById('org').value=='')
	  {
		  alert('Please Select Organization');
		  document.getElementById('org').focus();
		  return false;
	  }
	  
	   if(document.getElementById('cat').value=='')
	  {
		  alert('Please Select Category');
		  document.getElementById('cat').focus();
		  return false;
	  }
	  
	  if(document.getElementById('file').value=='')
	  {
		  alert('Please Enter Image');
		  document.getElementById('file').focus();
		  return false;
	  }
	  return true;
  }
  
  function validationarticle()
  {
	 
	 if(document.getElementById('title').value=='' || document.getElementById('title').value=='Title of article')
	  {
		  alert('Please Enter Title');
		  document.getElementById('title').focus();
		  return false;
	  }
	  
	   if(document.getElementById('org').value=='')
	  {
		  alert('Please Select Organization');
		  document.getElementById('org').focus();
		  return false;
	  }
	  
	   if(document.getElementById('cat').value=='')
	  {
		  alert('Please Select Category');
		  document.getElementById('cat').focus();
		  return false;
	  }
	  if(document.getElementById('author').value=='' || document.getElementById('author').value=='This article was written by')
	  {
		  alert('Please Enter Author Name');
		  document.getElementById('author').focus();
		  return false;
	  }
	  
	  if(document.getElementById('file').value=='')
	  {
		  alert('Please Enter Image');
		  document.getElementById('file').focus();
		  return false;
	  }
	  return true;
  }
  function previousone(nav)
  { 
  var rand = Math.random();
    var nx = parseInt(nav);
     var nxt
	  if(nx > 1)
	  {
	    nxt = nx - 1;
	   /*document.getElementById('hiddenprv').value = nx - 1;*/
	   document.getElementById('hiddennews').value = nx - 1;
	  }
	  else
	  {
		   nxt = nx ;
	  /*document.getElementById('hiddenprv').value = nx;*/
	  document.getElementById('hiddennews').value = nx;
	  }
	  
	  switch(nxt)
	{
		case 1:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('1')>Alpha Phi Alpha</a>";
			document.getElementById('one').src = HOST + "images/one-on.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 2:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('2')>Alpha Kappa Alpha</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two-on.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 3:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('3')>Kappa Alpha Psi</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three-on.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 4:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('4')>Omega Psi Phi</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four-on.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 5:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('5')>Delta Sigma Theta</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five-on.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 6:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('6')>Phi Beta Sigma</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six-on.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 7:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('7')>Zeta Phi Beta";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven-on.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 8:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('8')>Sigm Gamma Rho";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight-on.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 9:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('9')>Iota Phi Theta";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine-on.gif";
    		break;
    	default:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('1')>Alpha Phi Alpha";
			document.getElementById('one').src = HOST + "images/one-on.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
	}
   var xmlHttp;
  try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('replace').innerHTML = "<center><img src='" + HOST + "images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
    
	  document.getElementById('replace').innerHTML=xmlHttp.responseText;
      }
    }
  xmlHttp.open("GET",HOST + "request.news.latest.php?feedid="+nxt+"&rand="+rand,true);
    xmlHttp.send(null); 
  }
  
  
  function nextone(nav)
  {
	  var rand = Math.random();
	   var nx = parseInt(nav);
	   var nxt = nx + 1;
	       if(nxt > 9)
		   nxt = 9;
		  if(nx < 9)
		  {
			  
		  document.getElementById('hiddennews').value = nx + 1;
		  /*document.getElementById('hiddenprv').value = nx - 1;*/
		  }
		  else
		  {
		  document.getElementById('hiddennews').value = nx;
		 /* document.getElementById('hiddenprv').value = nx - 1;*/
		  }
		  
	    switch(nxt)
	{
		case 1:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('1')>Alpha Phi Alpha</a>";
			document.getElementById('one').src = HOST + "images/one-on.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 2:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('2')>Alpha Kappa Alpha</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two-on.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 3:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('3')>Kappa Alpha Psi</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three-on.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 4:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('4')>Omega Psi Phi</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four-on.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 5:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('5')>Delta Sigma Theta</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five-on.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 6:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('6')>Phi Beta Sigma</a>";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six-on.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 7:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('7')>Zeta Phi Beta";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven-on.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 8:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('8')>Sigm Gamma Rho";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight-on.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
    		break;
    	case 9:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('9')>Iota Phi Theta";
			document.getElementById('one').src = HOST + "images/one.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine-on.gif";
    		break;
    	default:
    		document.getElementById('orgname').innerHTML= "<a href='#' onClick = shownews('1')>Alpha Phi Alpha";
			document.getElementById('one').src = HOST + "images/one-on.gif";
			document.getElementById('two').src = HOST + "images/two.gif";
			document.getElementById('three').src = HOST + "images/three.gif";
			document.getElementById('four').src = HOST + "images/four.gif";
			document.getElementById('five').src = HOST + "images/five.gif";
			document.getElementById('six').src = HOST + "images/six.gif";
			document.getElementById('seven').src = HOST + "images/seven.gif";
			document.getElementById('eight').src = HOST + "images/eight.gif";
			document.getElementById('nine').src = HOST + "images/nine.gif";
	}
   var xmlHttp;
  try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('replace').innerHTML = "<center><img src='" + HOST + "images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
    
	  document.getElementById('replace').innerHTML=xmlHttp.responseText;
      }
    }
  xmlHttp.open("GET",HOST + "request.news.latest.php?feedid="+nxt+"&rand="+rand,true);
  xmlHttp.send(null); 
  }
  

function frameredirect(id) {
 if(parent.frames[1])
 {
 if(id == "index")
 {
  parent.location.href= HOST + 'index.php';
 }
 else if(id == "search")
 {
  parent.location.href= HOST + 'search/list';
 }
 else if(id == "wmail")
 {
  parent.location.href= HOST + 'wmail';
 }
 else if(id == "user")
 {
  parent.location.href= HOST + 'user/messages';
 }
 else if(id == "chat")
 {
  parent.location.href= HOST + 'chat';
 }
 else
 {
  parent.location.href= id;
 }
 }
}



 function shownextten(id,type,count)
  {
	  var rand = Math.random();
	  var hiddenvalue = document.getElementById('nxten').value;
	  hiddenvalue = parseInt(hiddenvalue);
	  var sethidden;
	  if(type == 'pre')
	  {
		  if(hiddenvalue <= 0)
		  {
		  document.getElementById('nxten').value = 0;
		  hiddenvalue = 0;
		  sethidden = 0;
		  }
		  else
		  {
		  document.getElementById('nxten').value = hiddenvalue - 10;
		  sethidden = hiddenvalue - 10;
		  hiddenvalue = hiddenvalue - 10
		  }
	  }
	  if(type == 'nex')
	  {
		  if(count < 10)
		  {
			document.getElementById('nxten').value = 0;
			 hiddenvalue = 0;
			 sethidden = 0;
		  }
		  else
		  {
			  if(hiddenvalue > count)
			  {
			  document.getElementById('nxten').value = count - 10;
			  hiddenvalue = count - 10;
			  sethidden = count - 10;
			  }
			  else
			  {
			  document.getElementById('nxten').value = hiddenvalue + 10;
			  sethidden = hiddenvalue + 10;
			  hiddenvalue = hiddenvalue + 10;
			  }
		  }
	  }
	  
   var xmlHttp;
  try
  {  
    // Firefox, Opera 8.0+, Safari  
    xmlHttp=new XMLHttpRequest();  
  }
catch (e)
  {  
    // Internet Explorer  
	try
    {    
	   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
	}
  catch (e)
    {    
	  try
      {      
	     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	   }
      catch (e)
      {      
	    alert("Your browser does not support AJAX!");      
		return false;      
	  }    
	 }  
    }

  xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState < 4)
      {
	  document.getElementById('newsdisplay').innerHTML = "<center><img src='images/pageLoading.gif' /></center>";
      }
    if(xmlHttp.readyState==4)
      {
    
	  document.getElementById('newsdisplay').innerHTML=xmlHttp.responseText;
      }
    }
  xmlHttp.open("GET","request.nextten.php?id="+id+"&rand="+rand+"&hvalue="+hiddenvalue+"&sethidden="+sethidden,true);
  xmlHttp.send(null);  
  }

function shownimg(id)
{
	document.getElementById(id).src = HOST + 'images/next-event2.gif';
}
function shownimg1(id)
{
	document.getElementById(id).src = HOST + 'images/arrow-next.gif';
}
function showpimg(id)
{
	document.getElementById(id).src = HOST + 'images/next-event3.gif';
}
function showpimg1(id)
{
	document.getElementById(id).src = HOST + 'images/arrow-prev.png';
}

function initialize() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
    geocoder = new GClientGeocoder();
  }
}

function showAddress(address) {
	document.getElementById('map_canvas').style.display="block";
	document.getElementById('clos').style.display="block";
   if (geocoder) {
     geocoder.getLatLng(
       address,
       function(point) {
         if (!point) {
           alert(address + " not found");
         } else {
           map.setCenter(point, 13);
           var marker = new GMarker(point);
           map.addOverlay(marker);
           marker.openInfoWindowHtml(address);
         }
       }
     );
   }
 }
		
function show(id1,id2) {
	document.getElementById(id1).style.display='block';
	document.getElementById(id2).style.display='none';
};

function select_chapter_fraternity(chapter_type_u, chapter_type_g, organization_id, state) {
	var type = '';
	
	if (chapter_type_u.checked == true) {
		type = 'undergraduate';
	} else if(chapter_type_g.checked == true) { 
		type = 'graduate';
	} else {
		alert('Please choose the type of the Chapter.');
		return;
	}
	
	ajax_load({
		url: root_address + 'getSignupChapters.php',
		pars: 'random=' + Math.random() + 
					'&type=' + type + 
					'&organization_id=' + organization_id + 
					'&state=' + state,
		hideloading: true,
		where: 'chapters'
	});
}

function selectAllFriends(obj) {
	if ($('selectedAll')) {
		$('selectedAll').checked = true;
	}
	
	var _do = true;
	
	if (obj.innerHTML == 'Select All') {
		_do = true;
		obj.innerHTML = 'Deselect All';
	} else {
		_do = false;
		obj.innerHTML = 'Select All';
	}
	
	var checkbox_elements = document.getElementsByClassName('_friends_');
	
	for (i = 0; i < checkbox_elements.length; i++) {
		checkbox_elements[i].checked = _do;
	}
}

//function newFriend() {}
//function displaySubMenu(obj) {}

var other_email_inc = 2;

function closeNewOtherEmail(id) {
	var _id = id - 1;
	
	$('e_div_' + _id).removeChild($('e_input_' + _id));
	$('e_a_' + _id).removeChild($('e_img_' + _id));
	$('e_div_' + _id).removeChild($('e_a_' + _id));
	$('more_emails').removeChild($('e_div_' + _id));
	other_email_inc--;
}

function addEmailsFromDB(emails) {
	var _emails = emails.split('###');
	for (var i = 0; i <= _emails.length - 1; i++) {
		addAnotherEmail(_emails[i]);
	}
}

function addAnotherEmail(email_value) {
	if (other_email_inc > 5) {
		alert('You can add only 5 other emails.');
		return;
	}
	
	var _input = document.createElement('input');
	_input.type = 'text';
	_input.value = email_value;
	_input.id = 'e_input_' + other_email_inc;
	_input.name = 'other_email[]';
	
	var _a = document.createElement('a');
	_a.href = 'javascript: void(0)';
	_a.id = 'e_a_' + other_email_inc;
	_a.onclick = function() {
		closeNewOtherEmail(other_email_inc);
	}
	
	var _img = document.createElement('img');
	_img.src = HOST + 'images/rem.jpg';
	_img.id = 'e_img_' + other_email_inc;
	_img.align = 'absmiddle';
	
	var _div = document.createElement('div');
	_div.id = 'e_div_' + other_email_inc;
	$('more_emails').appendChild(_div);
	
	$('e_div_' + other_email_inc).appendChild(_input);
	$('e_div_' + other_email_inc).appendChild(_a);
	$('e_a_' + other_email_inc).appendChild(_img);
	
	other_email_inc++;
}

var other_mess_inc = 2;

function closeNewOtherMess(id) {
	var _id = id - 1;
	
	$('m_div_' + _id).removeChild($('m_input_' + _id));
	$('m_a_' + _id).removeChild($('m_img_' + _id));
	$('m_div_' + _id).removeChild($('m_a_' + _id));
	$('more_mess').removeChild($('m_div_' + _id));
	other_mess_inc--;
}

function addMessesFromDB(messes) {
	var _messes = messes.split('###');
	for (var i = 0; i <= _messes.length - 1; i++) {
		addAnotherMess(_messes[i]);
	}
}

function addAnotherMess(email_value) {
	if (other_mess_inc > 5) {
		alert('You can add only 5 other messengers.');
		return;
	}
	
	var _input = document.createElement('input');
	_input.type = 'text';
	_input.value = email_value;
	_input.id = 'm_input_' + other_mess_inc;
	_input.name = 'other_mess[]';
	
	var _a = document.createElement('a');
	_a.href = 'javascript: void(0)';
	_a.id = 'm_a_' + other_mess_inc;
	_a.onclick = function() {
		closeNewOtherMess(other_mess_inc);
	}
	
	var _img = document.createElement('img');
	_img.src = HOST + 'images/rem.jpg';
	_img.id = 'm_img_' + other_mess_inc;
	_img.align = 'absmiddle';
	
	var _div = document.createElement('div');
	_div.id = 'm_div_' + other_mess_inc;
	$('more_mess').appendChild(_div);
	
	$('m_div_' + other_mess_inc).appendChild(_input);
	$('m_div_' + other_mess_inc).appendChild(_a);
	$('m_a_' + other_mess_inc).appendChild(_img);
	
	other_mess_inc++;
}

function reset( time ) {
	new Ajax.Request
	(
		'ajax.reset_seenme.php',
			{
				method : 'post',
				parameters : {time : time},
				onSuccess : function (transport)
					{
						response = transport.responseText;		
						if ( response == "DONE" )
							window.location.reload();
					},
					onFailure : function () {alert("Error retreving the file");}
			}
	);
}

function send_quick_message( to ) {
	var from = $('user').value;
	var subj = 'subject'+to;
	var subject = $(subj).value;
	var msg = 'message'+to;
	var message = $(msg).value;
	var fp = 'forward_profile'+to;
	new Ajax.Request
	(
		'ajax.send_quick_note.php',
			{
				method : 'post',
				parameters : {from: from, to: to, subject: subject, message: message},
				onSuccess : function (transport)
					{
						response = transport.responseText;		
						if ( response == "DONE" )
							Element.toggle(fp);
					},
					onFailure : function () {alert("Error retreving the file");}
			}
	);
}

function getWindowSize() {
	if (parseInt(navigator.appVersion) > 3) {
	 if (navigator.appName=="Netscape") {
	  var winW = window.innerWidth;
	  var winH = window.innerHeight;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  var winW = document.body.offsetWidth;
		var winH = document.body.offsetHeight;
	 }
	}
	return {width: winW, height: winH};
}

REMINDERS = {
	container: null,
	owner_id: null,
	friend_id: null,
	friend_note_value: null,
	
	createBox: function(owner_id, friend_id) {
		
		this.owner_id = owner_id;
		this.friend_id = friend_id;
		
		if (this.container != null) {
			this.container = '';
		}
		
		new Ajax.Request
		(
			HOST + 'setupReminders.php',
				{
					method : 'post',
					parameters : {
						action: 'display',
						owner_id: owner_id,
						friend_id: friend_id
					},
					onSuccess : function (transport)
						{
							response = transport.responseText;
							this.container = document.getElementById('REMINDER_CONTAINER_' + friend_id);
							REMINDERS.container = document.getElementById('REMINDER_CONTAINER_' + friend_id);
							this.container.innerHTML = response;
							REMINDERS.showBox();
							document.getElementById('friend_note').focus();
						}
				}
		);
	},
	
	closeBox: function() {
		if (this.container != null) {
			this.container.innerHTML = '';
		}
	},
	
	saveInfo: function() {
		var owner_id = this.owner_id;
		
		new Ajax.Request
		(
			HOST + 'setupReminders.php',
				{
					method : 'post',
					parameters : {
						action: 'save',
						owner_id: this.owner_id,
						friend_id: this.friend_id,
						real_name: $('real_name').value,
						phone:$('phone').value,
						email:$('email').value,
						aim:$('aim').value,
						yahoo:$('yahoo').value,
						link:$('link').value,
						save: 'save',
						note: $('friend_note').value
					},
					onSuccess : function (transport)
						{
							response = transport.responseText;
							if (response == 'ok') {
								var note_value = $('friend_note').value;
								
								if (note_value.length > 48) {
									$('note_brief_' + owner_id).innerHTML = note_value.substr(0, 48);
								} else {
									$('note_brief_' + owner_id).innerHTML = note_value;
								}
								
								this.container.innerHTML = '';
								
							} else if (response == 'Please write a Note for this user.') {
								alert('Please write a Note for this user.');
							}
						}
				}
		);
	},
	
	showBox: function() {
		
		if (this.container != null) {
			var w = getWindowSize();
			
			var leftPosPx = ((w.width == undefined ? window.innerWidth : w.width)  - 753) / 2;
			var topPosPx = (screen.height - 12) / 2;
			
			this.container.style.left = leftPosPx + 'px';
			this.container.style.top = topPosPx + 'px';
			
			this.container.style.display = 'block';
		}
	}
}

LOGIN = {
	container: null,
	
	displayLogin: function() {
		
		if (this.container != null) {
			this.container.innerHTML = '';
			this.container = '';
		}
		
		new Ajax.Request
		(
			HOST + 'setupLogin.php',
				{
					method : 'post',
					parameters : {
						action: 'display'
					},
					onSuccess : function (transport)
						{
							response = transport.responseText;
							this.container = document.getElementById('__LOGIN_BOX');
							LOGIN.container = document.getElementById('__LOGIN_BOX');
							this.container.innerHTML = response;
							LOGIN.showBox();
						}
				}
		);
	},
	
	closeBox: function() {
		if (this.container != null) {
			this.container.innerHTML = '';
		}
	},
	
	saveInfo: function() {
		new Ajax.Request
		(
			HOST + 'setupLogin.php',
				{
					method : 'post',
					parameters : {
						action: 'save'
					},
					onSuccess : function (transport)
						{
							response = transport.responseText;
							
						}
				}
		);
	},
	
	showBox: function() {
		
		if (this.container != null) {
			var w = getWindowSize();
			
			var leftPosPx = ((w.width == undefined ? window.innerWidth : w.width)  - 300) / 2;
			var topPosPx = ((screen.height) / 2) - 30;
			
			this.container.style.left = leftPosPx + 'px';
			this.container.style.top = topPosPx + 'px';
			
			this.container.style.display = 'block';
		}
	}
}

function calculateTxtLimit(obj) {
	var current_content = obj.value;
	if (current_content.length > 1000) {
		obj.value = current_content.substr(0, 1000);
	} else {
		$(obj.name + '_nr').update(obj.value.length);
	}
}


