function submit_frm(frm_name,action)
{
	data="<input type=hidden name=hidden_action value='" + action +"'>";
	document.getElementById('hidden_action').innerHTML =data;
	document.getElementById(frm_name).submit();	
}

function open_print_page(id)
{
	window.open("print_page.php?id="+id,"print","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}
function rename_form(i)
{
	//document.getElementById('input_new_file_'+i).innerHTML="<input type=text name=input_new_file_+i size=10/>";
	//document.getElementById('update_button_'+i).innerHTML="<input type=submit name=updet_name value=Update>";
	var content='';
	content+='<form action=index.php?name=file_manager method=post name=frm>';
	content+='<input type=text name=input_new_file_+i size=10/>';
    content+='<input type=submit name=updet_name value=Update />';
	content+='</form>';
	document.getElementById('update_button_'+i).innerHTML=content;
}


function select_file(num)
{
	if (window.ActiveXObject)
		{	
				if(document.select_all_ch.selectAll.checked==true)
				{
					for(i=0;i<num;i++)
					{
						document.select_all_ch.document.getElementById("select_"+i).checked = true;
					}
				}
				else if(document.select_all_ch.selectAll.checked==false)
				{
					for(i=0;i<num;i++)
					{
						
						document.select_all_ch.document.getElementById("select_"+i).checked =false;
					}
				}
		}
		else
		if (document.implementation && document.implementation.createDocument)
		{
			if(document.select_all_ch.selectAll.checked==true)
			{
				for(i=0;i<num;i++)
				{
					document.getElementById("select_"+i).checked = true;
				}
			}
			else if(document.select_all_ch.selectAll.checked==false)
			{
				for(i=0;i<num;i++)
				{
					
					document.getElementById("select_"+i).checked =false;
				}
			}

		}
		
}


function delete_data(size)
{
var i;
var values=Array[size];
values='';
for(i=0;i<size;i++)
	{
	
		if(document.getElementById("select_"+i).checked)
		  {
		     
			   values+=document.getElementById("select_"+i).value+",";
		  }

    }
	if(values!="")
	{
	 //window.location='index.php?name=file_manager&action=deleteItem&items='+values;
	 window.location='index.php?name=file_manager&action=confirmDelete&items='+values;
	}
	else
	{
		alert("Please Select Files or Folders To Delete"); 
	}
}
function up()
{
history.go(-1);
}
function move_file(size,url)
{
var selected_files='';
var i;
	for(i=0;i<size;i++)
		{
			if(document.getElementById("select_"+i).checked)
			{
				 if(document.getElementById("select_"+i).gettype!="dir")
				 {
					selected_files+=document.getElementById("select_"+i).value+",";
				 }
				 else
				 if(document.getElementById("select_"+i).gettype=="dir")
				 {
					alert("Cant Move Folders!");
					document.getElementById("select_"+i).checked = false;
					return false;
				 }
			}
		}
	if(selected_files!="")
	{
	window.open(url+"file_manager/popup.php?name=popupFilemanager&requestedfiles="+selected_files+"","move","width=750,height=400,top=100,left=350,scrollbars=YES,resizable=NO");
	window.location='index.php?name=file_manager';
	}
	else
	{   
		alert("Please Select Files To move");
		for(i=0;i<size;i++)
		{
			document.getElementById("select_"+i).checked = false;
		}
		
	}
	
    
}
function userList(type)
{
	window.location='?name=user_manegment&user_list='+type;
}

function app_deny_user(user_id,url)
{
	window.open(url+"/user/popup.php?name=approveDenyuser&id="+user_id,"move","width=390,height=550,top=50,left=350,scrollbars=YES,resizable=NO");
}
function commentRequiredDeny()
{
	if(document.getElementById("app_deny_user_comment").value=="")
	{
		alert("Please Insert Comment For Deny This User");
		
		return false;
	}
}

function close_page()
{
	window.close();
}

function populate()
{ 
	if (iedom)
	{
		cross_scroller=document.getElementById? document.getElementById("iescroller") : document.all.iescroller 
		cross_scroller.style.top=parseInt(scrollerheight)+8+"px" 
		cross_scroller.innerHTML=scrollercontent 
		actualheight=cross_scroller.offsetHeight 
	}
	else if (document.layers)
	{ 
		ns_scroller=document.ns_scroller.document.ns_scroller2 
		ns_scroller.top=parseInt(scrollerheight)+8 
		ns_scroller.document.write(scrollercontent) 
		ns_scroller.document.close() 
	actualheight=ns_scroller.document.height 
	}
	lefttime=setInterval("scrollscroller()",40) 
} 

function scrollscroller()
{ 
	if (iedom)
	{ 
		if (parseInt(cross_scroller.style.top)>(actualheight*(-1)+8)) 
			cross_scroller.style.top=parseInt(cross_scroller.style.top)-copyspeed+"px" 
		else 
			cross_scroller.style.top=parseInt(scrollerheight)+8+"px" 
	} 
	else if (document.layers)
	{ 
		if (ns_scroller.top>(actualheight*(-1)+8)) 
			ns_scroller.top-=copyspeed 
		else
			ns_scroller.top=parseInt(scrollerheight)+8 
	} 
}

function view_image_title(count)
{
	alert(count);
	var xmlHttp;
	var data='';
	countafter=count-1;
	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)
		{
			data=xmlHttp.responseText;
		}
		
		//use to check the return value
		//alert(xmlHttp.responseText);
	}
	xmlHttp.open("GET","get_image_description.php?count="+countafter,true);
	xmlHttp.send(null);
	document.getElementById("imageText").innerHTML=data;
}
function newfunction(image)
{
	alert(image);
}
