//JS things here


function postFrm(frm, page)
{
  var ele = frm.elements;
  
   
  var postData = new Array();
  
  for(i=0; i<ele.length; i++)
  {
  	if(arguments.length>2)
  	{
			if(ele[i].value=='')
			{
				alert(ele[i].name.toUpperCase()+' cannot be blank!');
				return;
			}
		}
  
    if(ele[i].name!='' || ele[i].id!='')
    {
      postData[ele[i].name] = ele[i].value;
      ele[i].value = '';
    }
  }
  
  postData['func'] = page;
  
  var postCMD = new ajax('functions.ajax.php','',postData);
  postCMD.post('FUNCCALL',false);
}

function viewProfile(userid)
{
	window.mFrame.location.href = "profile.php?UserId="+userid;
}

function loginfn(frm)
{
  if(frm.username.value=='' || frm.password.value=='')
  {
    alert("Please enter username and password");
    return false;
  }
  var postData = new Array();
  postData['username'] = frm.username.value;
  postData['password'] = frm.password.value;
  postData['func'] = 'login';
  
  var callCMD = new ajax('functions.ajax.php','',postData);
  callCMD.post('FUNCCALL', true);
}


function insSmiley(icon)
{
	$('shout').value += icon;
}

function loadVideoSection(vid)
{
	window.mFrame.location.href = "video.php?id="+vid;
}


function startSpot(ary)
{
	try{if(spotptr);}catch(e){spotptr = 0;}
	
	if(ary.length){
	$('inspot').innerHTML = "<a href='"+ary[spotptr][1]+"'><img src='gd.php?image="+ary[spotptr][1]+"&max=125' border=2 style='border-color:#fff;'/></a>"
														+"<br><a href='"+ary[spotptr][1]+"'>"+ary[spotptr][0]+"</a>";
	
		if(spotptr<ary.length-1)
		{
				spotptr++;
		}else
		{
			spotptr = 0;
		}
	}
	setTimeout(function(){
		startSpot(ary);
	},15000);
	

}


function forgotPassword()
{
  var email = prompt("Please enter your email address");
  if(email)
  {
    var postData = new Array();
    postData['email'] = email;
    postData['func'] = 'forgotPass';
    var callCMD = new ajax('functions.ajax.php','',postData);
    callCMD.post('ALERT');
  }
}


window.onload = function()
{
	if($('chatCont')!=null)
	{
		$('chatCont').style.position='fixed';
		$('chatCont').style.bottom='0px';
	}
}

window.onscroll = function()
{
	if(window.ActiveXObject)
	{
		if($('chatCont')!=null)
		{
			$('chatCont').style.top='0px';
		}
	}
}

function minimize()
{
	if(window.ActiveXObject)
		$('Chatbox').height='30';
	else
		$('eChatbox').height='30';
}

function maximize()
{
	if(window.ActiveXObject)
		$('Chatbox').height='520';
	else
		$('eChatbox').height='520';
}
