// JavaScript Document
function open_image_map(address,city,state,zip)
{
	window.open("map_preview.php?address="+address+"&city="+city+"&state="+state+"&zip="+zip+",width=400,height=400,scrollbars=yes,resizable=yes");
}
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,"img_preview","width="+width+",height="+height+",top=100,left=250,scrollbars=no,resizable=yes");
}


function video_preview(file_name)
{
window.open("video_preview.php?file_name="+file_name,"vid_preview","width=400,height=300,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="module_configuration.php?module="+module+"&id="+id+"&delete_category=1";
}



function confirm_delete()
{
	return_confirm=confirm("Are you sure that you want to delete these data?");
	if(return_confirm==true)
	{
		frm.trash.value=1;
		frm.submit();
	}
}


function open_pdf_page(id,module)
{
window.open("pdf_page.php?id="+id+"&module="+module,"pdf","width=50,height=50,scrollbars=no,resizable=no");
}

function open_email_page(id,module)
{
window.open("send_email.php?id="+id+"&module="+module,"email","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}

function open_print_page(id,module)
{
window.open("print_page.php?id="+id+"&module="+module,"print","width=600,height=600,top=100,left=350,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 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 width=85% border=0  cellpadding=2 cellspacing=2 align=center>";
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>File: "+(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?module=calendar&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=split_date[1]+"-"+split_date[2]+"-"+split_date[0];
}

function open_page_vote(id)
{
	window.open("vote_page.php?id="+id,"calendar","width=175,height=160,top=200,left=560,scrollbars=no");
}
function open_email_page_forum(id,request,id_ob)
{
	if(request=="View Article")
		id_name="category";
	else
	if(request=="View Answer")
		id_name="object_id";
	window.open("send_email.php?"+id_name+"="+id+"&module=forum&request="+request+"&id="+id_ob,"email","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}
function open_print_page_forum(id,request,id_ob)
{
	if(request=="View Article")
		id_name="category";
	else
	if(request=="View Answer")
		id_name="object_id";
	window.open("print_page.php?"+id_name+"="+id+"&module=forum&request="+request+"&id="+id_ob,"email","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}