/*
eco-generation.net
by amuro
*/



/* common */

function openwindow(url, name, width, height, scroll, resizable)
{
	if (!name) name='anywin'
	if (!width) width=500
	if (!height) height=300
	if (scroll) scr='yes'; else scr='no'
	if (resizable) res='yes'; else res='no'

	window.open(url, name, 'width='+width+', height='+height+', menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars='+scr+', resizable='+res)
}

function checklogin(form)
{
	if (!form.input_username.value)
	{
		// alert('input your username.')
		form.input_username.focus()
		return false
	}
	if (!form.input_password.value)
	{
		form.input_password.focus()
		return false
	}

	if (form.logintype.checked) form.action='https://eco-generation.net:444/login/login.html'

	return true
}



function checkAll(form, chkall, chkbox)
{
	var listform=document.getElementById(form); // var f = document.form;

	for (var i=0; i<listform.elements.length; i++)
	{
		var element=listform.elements[i];
 
		if ( element.name.indexOf(chkbox)==0 )
		{
			if (!document.getElementById(chkall).checked)
			{
				element.checked = 0; // f.all.checked = 0;
			}
			else
			{
				element.checked = 1; // f.all.checked = 1;
			}
		}
	}
}



/* etc */

function openwindow_console()
{
	openwindow('/console/', 'console', 950, 700, true, true)
}

function openwindow_message(to) // message
{
	// window.open('/message/', 'message', 'width=583, height=412, menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no')
	openwindow('/message/?to='+to, 'mbox', 565, 410, true)
	location.reload()
}

function openwindow_userprofile(username)
{
	openwindow('/friends/userprofile.html?username='+username, 'userprofile', 420, 370)
}

function openwindow_goldenbell()
{
	openwindow('/goldenbell/', 'goldenbell', 500, 379)
	// location.reload()
}

function openwindow_poll() // poll
{
	openwindow('/poll/', 'poll', 480, 420)
	location.reload()
}

function openwindow_honor()
{
	openwindow('/honor/', 'honor', 650, 600, true)
}

function openwindow_addressbook()
{
	openwindow('/land/email/addressbook/', 'addressbook', 470, 430, true)
}

function openwindow_group(no)
{
	openwindow('/community/group/group/?groupno='+no, 'group'+no, 920, 675)
	location.reload()
}

function openwindow_chat()
{
	openwindow('/chat/', 'chat', 310, 255)
	location.reload()
}

function openwindow_zipcode(city3) // zipcode
{
	openwindow('/apply/zipcode.html?input_city3='+city3, 'zipcode', 400, 330, true);
}

function openwindow_dic()
{
	openwindow('/etc/dic/', 'dic', 890, 690)
}



/* viewer */

function openwindow_imageview(filename)
{
	openwindow('/imageview.html?filename='+filename, 'image', 650, 500, true, true)
}

function openwindow_viewer2(filename, titlebar, sx, sy, addstr)
{
	openwindow('./view_window.html?filename='+filename+'&titlebar='+titlebar+'&'+addstr, 'image', sx, sy)
}

function openwindow_file(filename)
{
	openwindow(filename, 'image', 650, 500, true, true)
}

function openwindow_cert(str)
{
	openwindow('./view_window.html?'+str, 'cert', 650, 910)
}



/* popup menu */

function popupmenu_open(popmenu_name)
{
	popmenu_name.style.visibility="visible"
}

function popupmenu_close(popmenu_name)
{
	popmenu_name.style.visibility='hidden'
}



/* add */

var eMode=1

function format(sCommand, vValue)
{
	if (!eMode)
	{
		alert("ÆíÁý¸ðµå¸¸!")
		return
	}

	if (vValue=="removeFormat")
	{
		sCommand=vValue
		vValue=null
	}

	if (eMode)
	{
		if (vValue==null)
		document.execCommand(sCommand)
		else
		document.execCommand(sCommand, false, vValue)
	}
}



function FlashObject(byPath, byWidth, byHeight)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+byWidth+'" height="'+byHeight+'">');
	document.write('<param name="movie" value="'+byPath+'">');
	document.write('<param name="quality" value="high">');
	document.write('<embed src="'+byPath+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+byWidth+'" height="'+byHeight+'"></embed>');
	document.write('</object>');
}

/* EOF */
