var result_div;
var session_check = 'heck||||||||||valid||||||||login';
var session_check_replace = 'check||||||||||valid||||||||login';
var captcha;

//functions for get codes
function callAjax(path, div_id)
	{
		result_div = div_id;
		new AG_ajax(path,'ajaxResult');		
		return false;
	}

function ajaxResult(data)
	{
		data = unescape(data);
		var obj = document.getElementById(result_div);
		obj.style.display = 'block';
		if(data.indexOf(session_check)>=1)
			{
				data = data.replace(session_check_replace,'');
			}
		else
			{
				obj.innerHTML = '<span class="clsExpired" id="selExpired" style="align:right;">'+viewphoto_session_expired+'</span>';				
				return;
			}
		obj.innerHTML = '<h2><span>'+viewphoto_codes_to_display+'</span></h2>'+'<p class="clsAlignRight" id="close"> <a onClick=codeWindowClose("codeBlock")>'+viewphoto_close_code+'</a></p>'+data;
	}

function RegularExpressionReplace(expression, subject, replaced) 
	{
	  var re = new RegExp(expression, "g");
	  return subject.replace(re, replaced);
	}

function changeWidth(max_width_value)
	{		
		var width_value = document.formGetCode.image_width.value;
		if(parseInt(max_width_value)>=width_value && (!isNaN(width_value)))
			{
				var expression = 'width="([0-9]+)"';
				var subject = document.formGetCode.image_code.value;
				var replaced = 'width="'+width_value+'"';				
				document.formGetCode.image_code.value = RegularExpressionReplace(expression, subject, replaced);
			}
	}

function changeWidthOld()
	{		
		var width_value = document.formGetCode.image_width.value;
		if(max_width_value>=width_value && (!isNaN(width_value)))
			{
				var code_value = document.formGetCode.image_code.value;
				var code_arr = code_value.split('width="');
				code_arr[1] = code_arr[1].substring(code_arr[1].indexOf('"'));
				var new_code = code_arr[0]+'width="'+width_value+code_arr[1];		
				document.formGetCode.image_code.value = new_code;
			}
	}
	
function codeWindowClose(div_id)
	{
		var obj = document.getElementById(div_id);
		obj.innerHTML = '';
		obj.style.display = 'none';
	}

//functions for rating
var rate_click = true;
function callAjaxRate(path, div_id)
	{
		if(!rate_click)
			return false;
		rate_click = false;
		result_div = div_id;
		new AG_ajax(path,'ajaxResultRate');
		setTimeout('changeRatingStatus()',2000);
		return false;
	}
function changeRatingStatus(){
		rate_click = true;
}
function ajaxResultRate(data)
	{
		data = unescape(data);
		var obj = document.getElementById(result_div);
		obj.style.display = 'block';
		if(data.indexOf(session_check)>=1)
			{
				data = data.replace(session_check_replace,'');
			}
		else
			{
				return;				
			}
		
		if(data)
			{
				obj.innerHTML = data;
				obj.style.top = getAbsoluteOffsetTopConfirmation(document.getElementById('dAltMulti')) + 'px';
			}
	}
var img_src = new Array();
function mouseOver(count)
	{
		for(var i=1; i<=count; i++)
			{
				var obj = document.getElementById('img'+i);				
				img_src[i] = obj.src;
				obj.src = 'http://static.nicheflixxx.com/images/icon-ratehover.gif';
			}
		for(; i<=total_images; i++)
			{
				var obj = document.getElementById('img'+i);	
				img_src[i] = obj.src;
				obj.src = 'http://static.nicheflixxx.com/images/icon-rate.gif';
			}
	}

function mouseOut(count)
	{
		for(var i=1; i<=total_images; i++)
			{
				var obj = document.getElementById('img'+i);				
				obj.src = img_src[i];
			}
	}

//paging(next/previous link)
function callAjaxPaging(path, div_id)
	{
		result_div = div_id;
		new AG_ajax(path,'ajaxResultPaging');		
		return false;
	}
	
function ajaxResultPaging(data)
	{
		data = unescape(data);	
		var obj = document.getElementById(result_div);
		obj.style.display = 'block';
		if(data.indexOf(session_check)>=1)
			{
				data = data.replace(session_check_replace,'');
			}
		else
			{
				location.replace(replace_url);
				return;
			}
		data = data.split('+++++--++++!+++++++');
		obj.innerHTML = data[0];
		flagged_status = data[1];		
		hideFlaggedContent();
	}
function hideFlaggedContent()
	{
	if(flagged_status=="Yes")
		{
			var obj = '';
			if(obj = document.getElementById('membersAlbums'))
				{
					obj.style.display = 'none';
				}
			var obj = document.getElementById('addFavorite');
			obj.style.display = 'none';
			var obj = document.getElementById('selflaggedContent');
			obj.style.display = 'none';
			var obj = document.getElementById('confirmationDiv');
			obj.style.display = 'block';
		}
	}
function showFlaggedContent()
	{
		var obj = '';
			if(obj = document.getElementById('membersAlbums'))
				{
					obj.style.display = 'block';
				}
		var obj = document.getElementById('addFavorite');
		obj.style.display = 'block';
		var obj = document.getElementById('selflaggedContent');
		obj.style.display = 'block';
		var obj = document.getElementById('confirmationDiv');
		obj.style.display = 'none';
		return false
	}

function callAjaxAddGroups(path, div_id)
	{
		result_div = div_id;
		new AG_ajax(path,'ajaxResultAddGroups');		
		return false;
	}

function ajaxResultAddGroups(data){
	var obj = document.getElementById(result_div);		
	standardbody.style.overflow='hidden';
	showHideScreen(result_div);
	obj.style.top=(winH/2)-(128/2)+'px';
	obj.style.left=(winW/2)-(608/2)+'px';
	obj.style.display = 'block';
	scroll(0,0);
	data = unescape(data);		
	if(data.indexOf(session_check)>=1){
		data = data.replace(session_check_replace,'');
	}
	else{				
		return;
	}		
	obj.innerHTML = data;
	//obj.style.top = getAbsoluteOffsetTopConfirmation(document.getElementById('dAltMulti')) + 'px';
	}

function restoreFirstValue(id)
	{
		/*var obj = document.getElementById(id);		
		obj.style.display = 'none';
		obj.innerHTML = '';*/
		hideAllBlocks();
		return false;
	}

var addToGroup = function()
	{		
		if(arguments[1])
			addGroupsUrl = arguments[1];

		var group_ids = '';
		var frm = document.addGroups;		
		for (var i=0;i<frm.elements.length;i++)
			{
				var e=frm.elements[i];
				if (e.type=='checkbox' && e.checked)
					{
						group_ids += e.value + ',';
					}
			}
		var currpath = addGroupsUrl+'&group_ids='+group_ids;		
		callAjaxUpdateGroups(currpath,'selEditPhotoComments');
		return false
	}

function callAjaxUpdateGroups(path, div_id)
	{
		result_div = div_id;
		new AG_ajax(path,'ajaxResultUpdateGroups');		
	}

function ajaxResultUpdateGroups(data){
	data = unescape(data);
	var obj = document.getElementById(result_div);
	obj.style.display = 'block';
	if(data.indexOf(session_check)>=1){
		data = data.replace(session_check_replace,'');
	}		
	restoreFirstValue(result_div);
}
	
//favorites
var favorite_count = true;
function callAjaxFavoriteGroups(path, div_id)
	{
		//if(!favorite_count)
		if(0)
			return false;
			
		result_div = div_id;
		new AG_ajax(path,'ajaxResultAddGroups');		
		return false;
	}
var addToFavorite = function()
	{
		if(arguments[1])
			addFavoritesUrl = arguments[1];

		var favorite_id = '';
			
		var frm = document.addFavorites;
		for (var i=0;i<frm.elements.length;i++)
			{
				var e=frm.elements[i];
				if (e.type=='checkbox' && e.checked)
					{
						favorite_id += e.value + ',';
					}
			}
		var currpath = addFavoritesUrl+'&favorite_id='+favorite_id;
		//alert(currpath);return;
		callAjaxUpdateGroups(currpath,'selEditPhotoComments');
		
		var obj;		
		if(obj = document.getElementById('totalFavorite'))
			obj.innerHTML = parseInt(obj.innerHTML)+1;		
		favorite_count = false;
		
		return false
	}
//flag
function callAjaxFlagGroups(path, div_id)
	{
		result_div = div_id;
		new AG_ajax(path,'ajaxResultAddGroups');		
		return false;
	}

var addToFlag = function(){
	if(arguments[1])
		addFlagUrl = arguments[1];
	var flag = '';
	var frm = document.addFavorites;
	var values=0;
	for(var i=0;i<frm.elements.length;i++){
		var e=frm.elements[i];
		if(e.type=='checkbox' && e.checked){
			flag+=(values>0?',':'')+e.value;
			values++;
		}
	}
	var currpath = addFlagUrl+'&flag='+flag;
	//document.getElementById('cmdiframe').src=currpath;
	window.location.href='viewVideo.php?video_id='+mediaid;
	document.getElementById('selEditPhotoComments').style.display='none';
	standardbody.style.overflow='auto';
	document.getElementById('blackout').style.display='none';
	return false;
}
	
//Add Comments
function callAjaxAddComments(path, div_id)
	{		
		restoreFirstValue('selEditPhotoComments');
		//var obj = document.getElementById('selViewPostComment');
		//obj.style.display = 'none';
		result_div = div_id;
		new AG_ajax(path,'ajaxResultAddComments');		
		return false;
	}
function ajaxResultAddComments(data)
	{
		data = unescape(data);		
		var obj = document.getElementById(result_div);		
		obj.style.display = 'block';
		if(data.indexOf(session_check)>=1)
			{
				data = data.replace(session_check_replace,'');
			}
		else
			{				
				return;
			}
		data = data.split('***--***!!!');
		obj.innerHTML = data[0];
		captcha = data[1];		
	}
	
var addToComment = function()
	{		
		if(arguments[0])
			{
				if(!dontUse)
					addCommentsUrl = arguments[0];
			}
		
		var f = '';
			
		var frm = document.addComments;		
		for (var i=0;i<frm.elements.length;i++)
			{
				var e=frm.elements[i];
				if (e.type!='button' && e.name!='captcha_value')
					{
						var ovalue = Trim(e.value);
						if(ovalue)
							{
								ovalue = replace_string(ovalue, '\n', '<br />');
								f += ovalue;
							}
						else
							{
								e.value = '';
								e.focus();
								return false;
							}
					}
			}
		if(captcha!=frm.captcha_value.value)
			{				
				alert_manual('invalid captcha', 'alertHyperLink', 1000, 500);
				return;
			}
		var currpath = addCommentsUrl+'&f='+escape(f);
		//alert(currpath);return;
		callAjaxComment(currpath,'selCommentBlock');
		return false
	}

function clearComment()
	{
		var obj = document.getElementById('selAddComments');
		obj.style.display = 'none';
		//var obj = document.getElementById('selViewPostComment');
		//obj.style.display = 'block';
	}

function callAjaxComment(path, div_id)
	{
		//result_div = div_id;
		new AG_ajax(path,'ajaxResultComment');		
		return false;
	}

function ajaxResultComment(data)
	{
		data = unescape(data);		
		var obj = document.getElementById('selCommentBlock');		
		obj.style.display = 'block';
		if(data.indexOf(session_check)>=1)
			{
				data = data.replace(session_check_replace,'');
			}
		else
			{
				return;
			}
		data = data.split('***--***!!!');		
		obj.innerHTML = data[1];
		setEditTimerValue(data[0]);
		//if(obj = document.getElementById('selViewPostComment'))		
			//obj.style.display = 'block';
		if(comment_approval){
			if(obj = document.getElementById('totalComments'))
				obj.innerHTML = parseInt(obj.innerHTML)+1;
		}
		return;
	}

//delete comment
var tr_delete;
function deleteCommand(path, div_id)
	{		
		if(confirm(deleteConfirmation))
			{
				tr_delete = div_id;
				beforeDeleteResult();
				new AG_ajax(path,'deleteResult');
			}
		return false;		
	}

function beforeDeleteResult()
	{
		var obj;
		
		if(obj = document.getElementById(tr_delete))
			obj.style.display = 'none';
			
		if(obj = document.getElementById(tr_delete+'_1'))
			obj.style.display = 'none';
			
		if(obj = document.getElementById('total_comments1'))
			{			
				total_comments = parseInt(obj.innerHTML)-1;
				obj.innerHTML = total_comments;
			}
		
		if(obj = document.getElementById('total_comments2'))
			{
				total_comments = parseInt(obj.innerHTML)-1
				obj.innerHTML = total_comments;
			}
			
		if(total_comments && total_comments<=minimum_counts)
			{
				if(obj = document.getElementById('view_all_comments'))			
					obj.style.display = 'none';
			}
		
		if(obj = document.getElementById('totalComments'))
			obj.innerHTML = parseInt(obj.innerHTML)-1;	
	}

function deleteResult(data)
	{		
		return;		
	}

//group video comments
function callAjaxAddCommentsGroup(path, div_id)
	{		
		result_div = div_id;
		new AG_ajax(path,'ajaxResultAddComments');		
		return false;
	}

function clearCommentGroup()
	{
		var obj = document.getElementById('selAddComments');
		obj.style.display = 'none';		
	}

//view Video
var downloadCount = true;
function increaseDownload(block_name)
	{		
		return true;
		if(!downloadCount)
		return false;
		
		var obj;
		if(obj = document.getElementById(block_name))
			{
				download_count = download_count+1;
				obj.innerHTML = download_count;
			}
		downloadCount = false;
		return true;
	}

//Reply comment

var addToReply = function()
	{
		var comment_id = arguments[0];

		if(arguments[1])
			{
				if(!dontUse)
					addCommentsUrl = arguments[1];
			}

		var f = '';
			
		var frm = eval("document.addReply_"+comment_id);		
		for (var i=0;i<frm.elements.length;i++)
			{
				var e=frm.elements[i];
				if (e.type!='button')
					{
						var ovalue = Trim(e.value);
						if(ovalue)
							{
								ovalue = replace_string(ovalue, '\n', '<br />');
								f += ovalue;
							}
						else
							{
								e.value = '';
								e.focus();
								return false;
							}
					}
			}			
		var currpath = addCommentsUrl+'&comment_id='+comment_id+'&f='+escape(f);	
		callAjaxReplyFinal(currpath,'selCommentBlock');
		return false
	}
	
function callAjaxReplyFinal(path, block)
	{
		
		path = path;
		new AG_ajax(path,'ajaxResultReplyFinal');		
		return false;
	}
	
function ajaxResultReplyFinal(data)
	{
		data = unescape(data);	
		//alert(data);	
		var obj = document.getElementById('selCommentBlock');		
		obj.style.display = 'block';
		if(data.indexOf(session_check)>=1)
			{
				data = data.replace(session_check_replace,'');
			}
		else
			{
				return;
			}
		data = data.split('***--***!!!');		
		obj.innerHTML = data[1];
		setEditTimerValue(data[0]);
		return;
	}
	
function callAjaxReply(path, comment_id)
	{
		//result_div = div_id;
		path = path+'&comment_id='+comment_id;		
		new AG_ajax(path,'ajaxResultReply');		
		return false;
	}

function ajaxResultReply(data)
	{
		data = unescape(data);		
		if(data.indexOf(session_check)>=1)
			{
				data = data.replace(session_check_replace,'');
				
				data = data.split('***--***!!!');				
				var obj = document.getElementById('selAddComments_'+data[0]);
				obj.style.display = 'block';				
				obj.innerHTML = data[1];
						
				obj = document.getElementById('selViewPostComment_'+data[0]);
				obj.style.display = 'none';
				return true;
			}
		return false;
	}

function discardReply(comment_id)
	{		
		var obj = document.getElementById('selAddComments_'+comment_id);
		obj.style.display = 'none';
		var obj = document.getElementById('selViewPostComment_'+comment_id);
		obj.style.display = 'block';
	}

/*******for ediit comment functions started***********/
function callAjaxEdit(path, comment_id)
	{
		//result_div = div_id;
		path = path+'&type=edit&comment_id='+comment_id;		
		new AG_ajax(path,'ajaxResultEdit');		
		return false;
	}

function ajaxResultEdit(data)
	{
		data = unescape(data);	
		if(data.indexOf(session_check)>=1)
			{
				var obj;
				data = data.replace(session_check_replace,'');
				
				data = data.split('***--***!!!');
				
				if(obj = document.getElementById('selEditCommentTxt_'+data[0]))
					obj.style.display = 'none';					
				
				obj = document.getElementById('selEditComments_'+data[0]);
				obj.style.display = 'block';				
				var txt = replace_string(data['1'], '<br>', '\n');
				txt = replace_string(txt, '<br />', '\n');
				txt = trim(txt);
				obj.innerHTML = txt;
						
				obj = document.getElementById('selViewEditComment_'+data[0]);
				obj.style.display = 'none';
				return true;
			}
		return false;
	}

function discardEdit(comment_id)
	{		
		var obj;
		
		if(obj = document.getElementById('selEditCommentTxt_'+comment_id))
			obj.style.display = '';
		
		if(obj = document.getElementById('selEditComments_'+comment_id))
			obj.style.display = 'none';	
		
		if(obj = document.getElementById('selViewEditComment_'+comment_id))
			obj.style.display = '';				
	}

var addToEdit = function()
	{
		comment_id = arguments[0];

		if(arguments[1])
			addCommentsUrl = arguments[1];

		var f = '';
			
		var frm = eval("document.addEdit_"+comment_id);		
		for (var i=0;i<frm.elements.length;i++)
			{
				var e=frm.elements[i];
				if (e.type!='button')
					{
						var ovalue = Trim(e.value);
						if(ovalue)
							{
								ovalue = replace_string(ovalue, '\n', '<br />');
								f += ovalue;								
							}
						else
							{
								e.value = '';
								e.focus();
								return false;
							}
					}
			}
		f = escape(f);		
		var currpath = addCommentsUrl+'&comment_id='+comment_id+'&type=edit&f='+escape(f);	
		callAjaxUpdate(currpath,'selCommentBlock');
		return false
	}
	
function callAjaxUpdate(path, block)
	{
		
		path = path;
		new AG_ajax(path,'callAjaxUpdateResponse');		
		return false;
	}
	
function callAjaxUpdateResponse(data)
	{
		data = unescape(data);
		if(data.indexOf(session_check)>=1)
			{
				data = data.replace(session_check_replace,'');
			}
		else
			{
				return;
			}
		data = data.split('***--***!!!');
		
		if(obj = document.getElementById('selEditCommentTxt_'+data['0']))
			obj.innerHTML = data['1'];
			
		discardEdit(data['0']);
		return;
	}
/************ edit comments end ********/
function changeTimer(){	
	if(enabled_edit_fields_comment.length){
		doTimerFunction();
		setTimeout('changeTimer()',1000);
	}
}

function setEditTimerValue(comment_id){
	enabled_edit_fields_comment[enabled_edit_fields_comment.length] = comment_id;
	enabled_edit_fields_time[comment_id] = max_timer;
}

function doTimerFunction(){
	var val;
	var comment_id;
	for(var i in enabled_edit_fields_comment){
		comment_id = enabled_edit_fields_comment[i];
		if(i!='undefined' && i!='has' && i!='find'){
		val = enabled_edit_fields_time[comment_id];
		if(val<=1)
			hideDeleteEditLinks(comment_id);
		else if(val!=null)
			decrementTime(comment_id);
		}
	}			
}

function decrementTime(comment_id){	
	var obj;
	var val = enabled_edit_fields_time[comment_id];
	if(obj = document.getElementById('selViewTimerComment_'+comment_id)){
		obj.innerHTML = val-1;
		obj.innerHTML = obj.innerHTML+' Sec';
	}
	enabled_edit_fields_time[comment_id] = val-1;	
}
function hideDeleteEditLinks(comment_id){	
	var obj;
	var val = enabled_edit_fields_time[comment_id];	
	if(obj = document.getElementById('selViewDeleteComment_'+comment_id))
		obj.style.display = 'none';
	if(obj = document.getElementById('selViewEditComment_'+comment_id))
		obj.style.display = 'none';
	if(obj = document.getElementById('selViewTimerComment_'+comment_id))
		obj.style.display = 'none';
	if(obj = document.getElementById('cmd'+comment_id))
		obj.className = 'clsNotEditable';
	enabled_edit_fields_time[comment_id] = null;
}

function dumpMonth(month){
	switch(month){
		case 0:
			return 'January';
		break;
		case 1:
			return 'Febuary';
		break;
		case 2:
			return 'March';
		break;
		case 3:
			return 'April';
		break;
		case 4:
			return 'May';
		break;
		case 5:
			return 'June';
		break;
		case 6:
			return 'July';
		break;
		case 7:
			return 'August';
		break;
		case 8:
			return 'September';
		break;
		case 9:
			return 'October';
		break;
		case 10:
			return 'November';
		break;
		case 11:
			return 'December';
		break;
	}
}
function dumpHour(hour){
	if(hour>12)
		return hour-12;
	else
		return hour;
}
function dumpHourType(hour){
	if(hour>=12)
		return 'PM';
	else
		return 'AM';
}
function dumpDateType(date){
	switch(date){
		case 1:
		case 21:
		case 31:
			return 'st';
		break;
		
		case 2:
		case 22:
			return 'nd';
		break;
		
		case 3:
		case 23:
			return 'rd';
		break;
		
		default:
			return 'th';
		break;
	}
}
function commentbox(commentid,color){
	currentcontent=document.getElementById('c'+activecomment).innerHTML;
	document.getElementById('c'+commentid).innerHTML=currentcontent+box;
	document.getElementById('c'+commentid).style.display='block';
	document.getElementById('commentarea').focus();
	document.getElementById('commenttitle').style.display='none';
	activecomment=commentid;
	activecolor=color;
}
function cancelcomment(){
	document.getElementById('c'+activecomment).innerHTML=currentcontent;
	document.getElementById('commenttitle').style.display='block';
	if(document.getElementById('c'+activecomment).innerHTML=='')
		document.getElementById('c'+activecomment).style.display='none';
}
function submitcomment(video_id,parent_id){
	var comment=document.getElementById('commentarea').value;
	if(comment!=''){
		colors=Array('222222','333333');
		if(comments==false)
			document.getElementById('firstpost').style.display='none';
		var currentTime=new Date();
		
		commenthtml='<div style="margin:5px 0px 0px 0px;padding:5px;border:1px dashed #666666;width:460px;clear:both;background-color:#'+colors[activecolor]+'"><table cellpadding="0" cellspacing="0" style="font-size:12px;font-family:Arial, Helvetica, sans-serif;color:#fff"><tr><td style="vertical-align:top"><a href="viewProfile.php?user='+user_name+'"><img src="'+avatar+'"/></a></td><td><div style="margin-left:5px"><div>'+dumpMonth(currentTime.getMonth())+' '+currentTime.getDate()+dumpDateType(currentTime.getDate())+', '+currentTime.getFullYear()+' at '+dumpHour(currentTime.getHours())+':'+currentTime.getMinutes()+' '+dumpHourType(currentTime.getHours())+' - <span class="loginlinks"><a href="viewProfile.php?user='+user_name+'">'+user_name+'</a></span></div><div style="clear:both">'+comment+'</div></div></td></tr></table></div>';
	
		document.getElementById('c'+activecomment).innerHTML=currentcontent+commenthtml;
		document.getElementById('c'+activecomment).style.display='block';
		document.getElementById('cmdiframe').src='http://www.nicheflixxx.com/'+mediatype+'Comment.php?'+mediatype+'_id='+video_id+'&comment='+comment+(activecomment!=0?'&parent='+activecomment:'');
		document.getElementById('commenttitle').style.display='block';
		if(parent_id==0)
			activecolor=(activecolor==0?1:0);
		document.getElementById('total_comments').innerHTML=parseInt(document.getElementById('total_comments').innerHTML)+1;
	}
	else{
		alert('ERROR: You must enter a comment to submit.');
	}
}
function showFlagBox(){
	size=setSizes();
	scroll(0,0);
	document.getElementById('blackout').style.display='block';
	document.getElementById('blackout').style.visibility='visible';
	document.getElementById('mediaflag').style.top=(size[1]/2)-(200/2)+'px';
	document.getElementById('mediaflag').style.left=(size[0]/2)-(600/2)+'px';
	document.getElementById('mediaflag').style.display='block';
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	standardbody.style.overflow='hidden';
}
function hideFlagBox(){
	document.getElementById('mediaflag').style.display='none';
	document.getElementById('blackout').style.display='none';
	document.getElementById('blackout').style.visibility='hidden';
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	standardbody.style.overflow='';	
}
function doFlag(){
	var flags='';
	if(document.getElementById('flagtypeIllegal').checked==true)
		flags='Illegal';
	if(document.getElementById('flagtypeCopyright').checked==true)	
		flags=(flags!=''?flags+',Copyright':'Copyright');
	var url='viewVideo.php?ajax_page=true&page=flag&video_id='+mediaid+'&show=1&flag='+flags;
	document.getElementById('cmdiframe').src=url;
	hideFlagBox();
}
function deleteFavorite(type,id){
	document.getElementById('cmdiframe').src='http://www.nicheflixxx.com/deleteFavorite.php?type='+type+'&id='+id;
	switch(type){
		case 'photo':
			document.getElementById('add_to_favorites').innerHTML='<a href="#" onClick="return callAjaxFavoriteGroups(\'/members/viewPhoto.php?photo_id='+id+'&ajax_page=true&page=favorite\',\'selEditPhotoComments\')"><img src="/images/favorite.gif" style="margin:1px 2px 0 0" />Add To Favorites</a>';
		break;
		case 'music':
			document.getElementById('add_to_favorites').innerHTML='<a href="#" onClick="return callAjaxFavoriteGroups(\'/members/music.php?music_id='+id+'&ajax_page=true&page=favorite\',\'selEditPhotoComments\')"><img src="/images/favorite.gif" alt="Add To Favorites" style="padding:1px 2px 0 0"/>Add To Favorites</a>';
		break;
	}
}