// JavaScript Document

function show_image(object_id,image_name,width,height)
{
x_pos=event.screenX+document.body.scrollLeft;
y_pos=event.screenY+document.body.scrollTop;
image_div.style.left=x_pos+10;
image_div.style.top=y_pos+10-height;
image_div.style.visibility='visible';
image_div.innerHTML="<img src='"+image_name+"' width="+width+" height="+height+" class=empty_border>";
}
function hide_image()
{
image_div.style.visibility='hidden';
image_div.innerHTML="";
}

function image_preview(file_name,width,height)
{
window.open("image_preview.php?file_name="+file_name+"&width="+width+"&height="+height,"preview","width="+width+",height="+height+",top=100,left=250,scrollbars=no,resizable=yes");
}

function delete_module_category(module,id)
{
	return_confirm=confirm("Are you sure that you want to delete this category?");
	if(return_confirm==true)
	window.location="index.php?module="+module+"&id="+id+"&delete_category=1";
}


function open_email_page(id,module,language)
{
window.open("send_email.php?id="+id+"&m="+module+"&language="+language,"email","width=650,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}

function open_print_page(id,module,language)
{
window.open("print_page.php?id="+id+"&m="+module+"&language="+language,"print","width=750,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}


function data_preview(id,module)
{
window.open("data_preview.php?id="+id+"&module="+module,"preview","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}


function open_poll_result(id,module,ar)
{
window.open("poll_result.php?id="+id+"&module="+module+"&lang="+ar,"poll","width=324,height=252,top=200,left=450,scrollbars=yes,resizable=no");
}

function create_uploads(loop)
{
if(loop<=0)
frm.upload_num.value=1;
else
frm.upload_num.value=loop;

if(loop>0)
{
i=0;
upload_contents="";
upload_contents=upload_contents+"<table border=0  cellpadding=2 cellspacing=2 align=right>";
for(i=0;i<loop;i++)
{
upload_contents=upload_contents+"<tr><td align=center><table width=100% border=0 cellpadding=0 cellspacing=0 align=center>";
upload_contents=upload_contents+"<tr><td width=25% class=normal_text align=left>"+(i+1)+"- </td><td align=left><input name=file_"+i+" type=file size=40></td></tr>";
upload_contents=upload_contents+"</table></td></tr>";
}
upload_contents=upload_contents+"</table>";
uploads.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 open_calendar_window(target)
{
window.open("calendar_popup.php?target="+target,"calendar","width=175,height=160,top=200,left=560,scrollbars=no");
}

function get_date(target,date)
{

split_date="";
split_date=date.split("-");
document.getElementById(target).value=date;
}

function confirm_delete(m,id,language)
{
	confirm_result=confirm("هل انت متأكد من حذف هذه المعلومات؟");
	if(confirm_result==true)
	{
		window.location="index.php?m="+m+"&id="+id+"&mode=Delete&language="+language;
	}
}
