/**************************************************************/
/**************************************************************/
function adjustMessages(action){
	TA_submitForm('messagesList', 'updateMessages&subaction='+action, '/includes/php/inc.functions-jeremy_ajax.php', 'messageList');
	}
/**************************************************************/
/**************************************************************/


/**************************************************************/
/**************************************************************/
function pageJump(section){
	switch(section){
		case 1:
			location.href = '/users/my-messages-inbox.php';
			break;
	}
}
/**************************************************************/
/**************************************************************/


/**************************************************************/
/*******************SUPER SELECT FUNCTIONALITY*****************/
function superSelect(element, type, text, varsPassed){
	TA_attachBox(element, 'superselect', 'action='+type+'&text='+text+'&'+varsPassed, '../includes/inc.super_select.php');
}	
	
function ss_returnData(type, arg1, arg2, arg3){
	switch(type){
		case "email":
			ss_updateMessageEmail(arg1,arg2);
			TA_hideDiv();
			break;
			
		case "tag_article":
			//arg1 = User_ID
			document.getElementById('people').value = '';
			var insert_id = document.getElementById('insert_id').value;
			updateContentArea('people_list_names', 'action=tag_article&insert_id='+insert_id+'&User_ID='+arg1, '../includes/php/inc.functions-jeremy_ajax.php', '', 'plus');
			break;			
			
			
		case "tag_video":
			//arg1 = User ID
			//arg2 = Video ID
			//arg3 = return field name
			updateContentArea(arg3, 'action=tag_video&Video_ID='+arg2+'&User_ID='+arg1, '../includes/php/inc.functions-jeremy_ajax.php');
			break;
			
		case "tag_photo":
			//arg1 = User ID
			//arg2 = Photo ID
			//arg3 = return field name
			updateContentArea(arg3, 'action=tag_photo&Photo_ID='+arg2+'&User_ID='+arg1, '../includes/php/inc.functions-jeremy_ajax.php');
					
			break;
			
		case "groupInvite":
			//arg1 = User ID
			//arg2 = Group ID
			//arg3 = return field name
			updateContentArea(arg3, 'action=groupInvite&Group_ID='+arg2+'&User_ID='+arg1, '../includes/php/inc.functions-jeremy_ajax.php');
			break;
			
			
		case "groupInvite_2":
			//arg1 = User ID
			//arg2 = Group ID
			//arg3 = return field name
			updateContentArea(arg3, 'action=groupInvite_2&Group_ID='+arg2+'&User_ID='+arg1, '../includes/php/inc.functions-jeremy_ajax.php');
			window.alert('Your invitation has been sent');
			break;		
	}
	
}

function ss_updateMessageEmail(User, ID){
	if(document.getElementById('messageTo')){
		document.getElementById('messageTo').value = User;
	}
	
	if(document.getElementById('User_ID')){
		document.getElementById('User_ID').value = ID;
	}
}

function removeTag(ID){
	updateContentArea('person_'+ID, 'action=removeTag&ID='+ID, '../includes/php/inc.functions-jeremy_ajax.php');
	}

function removeInvite(ID){
	updateContentArea('person_'+ID, 'action=removeInvite&ID='+ID, '../includes/php/inc.functions-jeremy_ajax.php');
	}
	
function ss_updatePeopleList(User){

}
/*****************END SUPER SELECT FUNCTIONALITY***************/
/**************************************************************/


/**************************************************************/
/*****************ARTICLE ROTATOR FUNCTIONS********************/
//SET THE INITIAL CURRENT ARTICLE VALUE
var curArticle = 0;
var articlesNum = 0;
var articleTimer = '';
function changeArticle(id){

	if(curArticle==articlesNum){
		curArticle=0;
		}

	//IF NO ID IS SET, GRAB THE VALUE OF THE CURRENT ARTICLE	
	if(!id){
		curArticle++;
		}else{
		curArticle = id;
		}
		
	for(i=1;i<6;i++){
		var imageName = "Image_"+i;
		var articleName = "article_box_"+i;					
		if(document.getElementById(imageName)){
			document.getElementById(imageName).style.display = "none";
			}
		if(document.getElementById(articleName)){
			document.getElementById(articleName).style.display = "none";					
			}
		}
	var imageName = "Image_"+curArticle;
	var articleName = "article_box_"+curArticle;					
	document.getElementById(imageName).style.display = "block";
	document.getElementById(articleName).style.display = "block";

	if(id){
		if(articleTimer){
			window.clearTimeout(articleTimer);
			}
		}else{
		articleTimer = window.setTimeout("changeArticle()", 3500);	
		}				
	}
/***************END ARTICLE ROTATOR FUNCTIONS******************/
/**************************************************************/			

/**************************************************************/
/*****************FILE EXPLORER FUNCTIONS**********************/
function handleFileReturn(filename){
	TA_hideDiv();
	
	var Gallery_ID = document.getElementById('Gallery_ID').value;
	var fileType = document.getElementById('upload_type').value;
	
	if(fileType=="video"){
		var content = "<center><img src='../includes/images/loadingAnimation.gif'><br>Processing Your Video Request</center>";
		TA_showBox('loadingWindow', 400, content, '', '', 0);
		//window.alert(filename);
		updateContentArea('empty', 'Gallery_ID='+Gallery_ID+'&file='+filename, '../includes/php/inc.functions-handle_video_upload.php', "updateGallery()");
	}else if(fileType=="photo"){
		var content = "<center><img src='../includes/images/loadingAnimation.gif'><br>Processing Your Photo Request</center>";
		TA_showBox('loadingWindow', 150, content, '', '0', 1);
//		try{location.href = 'php/inc.handle_photo_upload.php?Gallery_ID='+Gallery_ID+'&file='+filename;} catch (e) {alert(e);}
		updateContentArea('empty', 'Gallery_ID='+Gallery_ID+'&file='+filename, '../includes/php/inc.functions-handle_photo_upload.php', "updateGallery()");
	}
}
/***************END FILE EXPLORER FUNCTIONS********************/
/**************************************************************/

