// JavaScript Document

function show_image(object_id,image_name,width,height)
{

var posx = 0;
var posy = 0;
if (!e) var e = window.event;
if (e.pageX || e.pageY) 	{
	posx = e.pageX;
	posy = e.pageY;
}
else if (e.clientX || e.clientY) 	{
	posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
	posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
	
image_div.style.left = posx+10+"px";
image_div.style.top = posy+10+"px";

image_div.style.visibility='visible';
image_div.innerHTML="<img src='"+image_name+"' width="+width+" height="+height+" style='background-color:#EAEAEA;padding:10px;display:block;'>";
}
function hide_image()
{
image_div.style.visibility='hidden';
image_div.innerHTML="";
}

function image_preview(module,id,file_name,upload_type,width,height)
{
window.open("image_preview.php?module="+module+"&id="+id+"&file_name="+file_name+"&upload_type="+upload_type+"&width="+width+"&height="+height,"preview","width="+width+",height="+height+",top=65,left=320,scrollbars=no,resizable=yes");
}

function video_preview(file_name,width,height)
{
window.open("video_preview.php?file_name="+file_name+"&width="+width+"&height="+height,"preview","width="+width+",height="+height+",top=100,left=250,scrollbars=no,resizable=no");
}





function create_uploads_pre(loop,title_lang,file_lang,active_lang)
{
	var title_array=new Array();
	var file_array=new Array();
	var path_array=new Array();
	var active_array=new Array();
	
	if(frm.previous_uploads_num_pre.value>0)
	{
		for(i=0;i<frm.previous_uploads_num_pre.value;i++)
		{
			title_array[i]=frm.document.getElementById("file_title_"+i+"_pre").value;
			file_array[i]=frm.document.getElementById("file_"+i+"_pre").value;
			path_array[i]=frm.document.getElementById("path_"+i+"_pre").value;
			if(frm.document.getElementById("active_file_"+i+"_pre").checked)
			active_array[i]="checked";
		}
	}

	if(loop<=0)
	frm.upload_num_pre.value=1;
	else
	frm.upload_num_pre.value=loop;
	
	frm.previous_uploads_num_pre.value=frm.upload_num_pre.value;
	
	if(loop>0)
	{
		i=0;
		upload_contents="";
		upload_contents=upload_contents+"<table border=0 cellpadding=2 cellspacing=2 width=100%>";
		for(i=0;i<loop;i++)
		{
			if(title_array[i]==null)
			title_array[i]='';
			
			if(file_array[i]==null)
			file_array[i]='';
			
			if(path_array[i]==null)
			path_array[i]='';
			upload_contents=upload_contents+"<tr><td><table width=100% border=0 cellpadding=1 cellspacing=1 align=center>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+title_lang+": </td><td><input name=file_title_"+i+"_pre type=text size=40 value='"+title_array[i]+"'></td></tr>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+file_lang+": </td><td><input name=file_"+i+"_pre type=file size=40 value='"+file_array[i]+"'><input name=path_"+i+"_pre type=hidden value='"+path_array[i]+"'></td></tr>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+active_lang+": </td><td><input name=active_file_"+i+"_pre type=checkbox value=1 class=radio "+active_array[i]+"></td></tr>";
			upload_contents=upload_contents+"</table></td></tr>";
		}
		upload_contents=upload_contents+"</table>";
		uploads_pre.innerHTML=upload_contents;
	}
}


function create_uploads_during(loop,title_lang,file_lang,active_lang)
{
	var title_array=new Array();
	var file_array=new Array();
	var path_array=new Array();
	var active_array=new Array();
	
	if(frm.previous_uploads_num_pre.value>0)
	{
		for(i=0;i<frm.previous_uploads_num_pre.value;i++)
		{
			title_array[i]=frm.document.getElementById("file_title_"+i+"_during").value;
			file_array[i]=frm.document.getElementById("file_"+i+"_during").value;
			path_array[i]=frm.document.getElementById("path_"+i+"_during").value;
			if(frm.document.getElementById("active_file_"+i+"_during").checked)
			active_array[i]="checked";
		}
	}

	if(loop<=0)
	frm.upload_num_during.value=1;
	else
	frm.upload_num_during.value=loop;
	
	frm.previous_uploads_num_during.value=frm.upload_num_during.value;
	
	if(loop>0)
	{
		i=0;
		upload_contents="";
		upload_contents=upload_contents+"<table border=0 cellpadding=2 cellspacing=2 width=100%>";
		for(i=0;i<loop;i++)
		{
			if(title_array[i]==null)
			title_array[i]='';
			
			if(file_array[i]==null)
			file_array[i]='';
			
			if(path_array[i]==null)
			path_array[i]='';
			upload_contents=upload_contents+"<tr><td><table width=100% border=0 cellpadding=1 cellspacing=1 align=center>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+title_lang+": </td><td><input name=file_title_"+i+"_during type=text size=40 value='"+title_array[i]+"'></td></tr>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+file_lang+": </td><td><input name=file_"+i+"_during type=file size=40 value='"+file_array[i]+"'><input name=path_"+i+"_during type=hidden value='"+path_array[i]+"'></td></tr>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+active_lang+": </td><td><input name=active_file_"+i+"_during type=checkbox value=1 class=radio "+active_array[i]+"></td></tr>";
			upload_contents=upload_contents+"</table></td></tr>";
		}
		upload_contents=upload_contents+"</table>";
		uploads_during.innerHTML=upload_contents;
	}
}


function create_uploads_post(loop,title_lang,file_lang,active_lang)
{
	var title_array=new Array();
	var file_array=new Array();
	var path_array=new Array();
	var active_array=new Array();
	
	if(frm.previous_uploads_num_pre.value>0)
	{
		for(i=0;i<frm.previous_uploads_num_pre.value;i++)
		{
			title_array[i]=frm.document.getElementById("file_title_"+i+"_post").value;
			file_array[i]=frm.document.getElementById("file_"+i+"_post").value;
			path_array[i]=frm.document.getElementById("path_"+i+"_post").value;
			if(frm.document.getElementById("active_file_"+i+"_post").checked)
			active_array[i]="checked";
		}
	}

	if(loop<=0)
	frm.upload_num_post.value=1;
	else
	frm.upload_num_post.value=loop;
	
	frm.previous_uploads_num_post.value=frm.upload_num_post.value;
	
	if(loop>0)
	{
		i=0;
		upload_contents="";
		upload_contents=upload_contents+"<table border=0 cellpadding=2 cellspacing=2 width=100%>";
		for(i=0;i<loop;i++)
		{
			if(title_array[i]==null)
			title_array[i]='';
			
			if(file_array[i]==null)
			file_array[i]='';
			
			if(path_array[i]==null)
			path_array[i]='';
			upload_contents=upload_contents+"<tr><td><table width=100% border=0 cellpadding=1 cellspacing=1 align=center>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+title_lang+": </td><td><input name=file_title_"+i+"_post type=text size=40 value='"+title_array[i]+"'></td></tr>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+file_lang+": </td><td><input name=file_"+i+"_post type=file size=40 value='"+file_array[i]+"'><input name=path_"+i+"_post type=hidden value='"+path_array[i]+"'></td></tr>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+active_lang+": </td><td><input name=active_file_"+i+"_post type=checkbox value=1 class=radio "+active_array[i]+"></td></tr>";
			upload_contents=upload_contents+"</table></td></tr>";
		}
		upload_contents=upload_contents+"</table>";
		uploads_post.innerHTML=upload_contents;
	}
}


function CreateControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL)
{
  var d = document.getElementById(DivID);
  contents="";
  contents=contents+"<object classid='"+CLSID+"' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' id='"+ObjectID+"' width='"+WIDTH+"' height='"+HEIGHT+"'>";
  contents=contents+"<param name='allowScriptAccess' value='sameDomain' />";
  contents=contents+"<param name='movie' value='"+URL+"' />";
  contents=contents+"<param name='loop' value='false' />";
  contents=contents+"<param name='menu' value='false' />";
  contents=contents+"<param name='quality' value='high' />";
  contents=contents+"<param name='wmode' value='transparent' />";
  contents=contents+"<param name='bgcolor' value='#ffffff' />";
  contents=contents+"<embed src='"+URL+"' loop='false' menu='false' quality='high' wmode='transparent' bgcolor='#ffffff'  width='"+WIDTH+"' height='"+HEIGHT+"' name='"+ObjectID+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
  contents=contents+"</object>";
      
  d.innerHTML =contents;
}

function confirm_delete(module,id,delete_msg,delete_mode,remaining_url)
{
	confirm_result=confirm(delete_msg);
	if(confirm_result==true)
	{
		window.location="index.php?module="+module+"&id="+id+"&mode="+delete_mode+remaining_url;
	}
}

function confirm_restore(module,id,restore_msg,restore_mode,remaining_url)
{
	confirm_result=confirm(restore_msg);
	if(confirm_result==true)
		window.location="index.php?module="+module+"&id="+id+"&mode="+restore_mode+remaining_url;
}

function open_email_page(id,module,category)
{
	window.open("send_email.php?id="+id+"&module="+module+"&category="+category,"email","width=460,height=210,top=180,left=350,scrollbars=yes,resizable=yes");
}

function open_print_page(id,module,category)
{
	window.open("print_page.php?id="+id+"&module="+module+"&category="+category,"print","width=750,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}



function create_uploads(loop,title_lang,file_lang,active_lang)
{
	var title_array=new Array();
	var file_array=new Array();
	var path_array=new Array();
	var active_array=new Array();
	
	if(frm.previous_uploads_num.value>0)
	{
		for(i=0;i<frm.previous_uploads_num.value;i++)
		{
			title_array[i]=frm.document.getElementById("file_title_"+i).value;
			file_array[i]=frm.document.getElementById("file_"+i).value;
			path_array[i]=frm.document.getElementById("path_"+i).value;
			if(frm.document.getElementById("active_file_"+i).checked)
			active_array[i]="checked";
		}
	}

	if(loop<=0)
	frm.upload_num.value=1;
	else
	frm.upload_num.value=loop;
	
	frm.previous_uploads_num.value=frm.upload_num.value;
	
	if(loop>0)
	{
		i=0;
		upload_contents="";
		upload_contents=upload_contents+"<table border=0 cellpadding=2 cellspacing=2 width=70%>";
		for(i=0;i<loop;i++)
		{
			if(title_array[i]==null)
			title_array[i]='';
			
			if(file_array[i]==null)
			file_array[i]='';
			
			if(path_array[i]==null)
			path_array[i]='';
			upload_contents=upload_contents+"<tr><td><table width=100% border=0 cellpadding=0 cellspacing=0 align=center>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+title_lang+": </td><td><input name=file_title_"+i+" type=text size=40 value='"+title_array[i]+"'></td></tr>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+file_lang+": </td><td><input name=file_"+i+" type=file size=40 value='"+file_array[i]+"'><input name=path_"+i+" type=hidden value='"+path_array[i]+"'></td></tr>";
			upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+active_lang+": </td><td><input name=active_file_"+i+" type=checkbox value=1 class=radio "+active_array[i]+"></td></tr>";
			upload_contents=upload_contents+"</table></td></tr>";
		}
		upload_contents=upload_contents+"</table>";
		uploads.innerHTML=upload_contents;
	}
}
