///////////////////////////////////////////////////////////
// confirm something
function request(message)
{
  if(confirm(message)) return true;
  else return false;
}
///////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
// roll & expand
function expand(id)
{
  document.getElementById(id+'_opened').style.display = '';
  document.getElementById(id+'_closed').style.display = 'none';
}
function roll(id)
{
  document.getElementById(id+'_opened').style.display = 'none';
  document.getElementById(id+'_closed').style.display = '';
}
///////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
// open w2 window
function w2(url, name, width, height, scroll)
{
  var w2 = window.open(url, name, 
'marginheight=0,marginweight=0,toolbar=no,width='+width+',height='+height+',left=20,top=20,resizable=no,scrollbars='+scroll);
  w2.focus();
}
///////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
// preview
function preview(form, action, request, width, height, scroll)
{
  var doc = document.forms[form];
  w2('/_admincp/w2.html', 'w2', width, height, scroll);
  doc.action = '/_admincp/w2.html?rq='+request;
  doc.target = 'w2';
  doc.submit();
  doc.action = action;
  doc.target = '_self';
  
  return false;
}
///////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
// window for edit image
function editimg(dir,file,width,height) {
 var x,y;
		x=970;	
		y=680;

   win=window.open("editimg.html?width="+width+"&height="+height+"&file="+file+"&dir="+dir,"",
       "width="+x+", height="+y+", top="+(screen.height/2-y/2)+", left="+(screen.width/2-x/2)+",resizable=1,dependent,scrollbars=0");

//////////////////////////////////////////////////////////
}

function openWin1(im,hd,h,w){
   var pic='"'+hd+'"'+" HEIGHT="+'"'+h+'"'+" SRC="+'"'+im+'"'+" WIDTH="+'"'+w+'"';
   var wn="width="+w+","+"height="+h+","+"status=no,toolbar=no,menubar=no, resizable=yes,scrollbars=yes";
   myWin=open("","_blank",wn);
   myWin.document.write('<HTML>');
   myWin.document.write('<HEAD><TITLE>'+hd+'</TITLE></HEAD>');
   myWin.document.write('<BODY LEFTMARGIN="0" TOPMARGIN="0" rightmargin="0" bottommargin="0" >');
   myWin.document.write('<IMG ALIGN="center"  border="0" bordercolor="#cccccc"  ALT='+pic+'>')
   myWin.document.write('</BODY>');
   myWin.document.write('</HTML>');
}
