function w_clear_all_item(TForm)
{
	for (var i = 0; i< TForm.elements.length; i++)
	{
		var ele = TForm.elements[i];
		if (ele.type)
		{
			var type = ele.type.toLowerCase();
			if ((type != "hidden") && (type != "button") && (type != "submit") && (type !="image"))
			{
				if (ele.value)
				{
					ele.value = "";
				}
			}
		}
	}
	return;
}
function Init()
{
//%3=0->Variable; %3=1->Type; %3=2->Value
//radion type = 0; check box type =1; select type=2
        for (var i=0; i< Init.arguments.length; i++)
        {
                var var_1= Init.arguments[i];
                var var_2= Init.arguments[i+1];
                var var_3= Init.arguments[i+2];
		if (var_1)
                {
                	if (var_2 == 0)
                                Init_radio(var_1, var_3);
                        else if (var_2 == 1)
                                Init_check(var_1,var_3);
                        else
                                Init_select(var_1,var_3);
                }
                i += 2;
        }
}

function Init_radio(myradio, com_value)
{
        for (var i=0; i< myradio.length; i++)
        {
                if (myradio[i].value == com_value)
                        if (!myradio[i].checked)
                                myradio[i].checked = true;
        }
}

function Init_check(mycheck, com_value)
{
	if ( com_value == "" ) return;
        if (mycheck.value == com_value)
                if (!mycheck.checked)
                        mycheck.checked = true;
}

function Init_select(myselect, com_value)
{

        for (var i=0; i< myselect.length; i++)
        {
                if (myselect.options[i].value == com_value)
                {
                        myselect.selectedIndex = i;
                        break;
                }
        }
}

//This size is especially for browseing window
function open_win(href, d_window)
{
	t_Win = window.open(href,"t_Win","width=700,height=500,toobar=no, status=no, scrollbars=yes, resize=no, menubar=no");
	if ((d_window != null) && (!t_Win.opener))
             t_Win.opener = d_window;
}

//This is For Page Browsing
function page_win(href)
{
	t_Win = window.open(href,"theWindow","width=750,height=600,toobar=no, status=no, scrollbars=yes, resizable=yes, menubar=no");
}

function submit_win(TForm)
{
	t_Win = window.open("","theWindow","width=750,height=600,toobar=no, status=no, scrollbars=yes, resizable=yes, menubar=no");
	if (TForm)
	{
		TForm.target = "theWindow";
		TForm.submit();
	}
	else
		alert("No Specific Form Exist!");
}

function word_count(ttext, limit , errormessage)
{
	if (ttext)
	{
		if (ttext.value.length > limit)
		{
			var check_error = errormessage;
			if (check_error == '')
			{
				check_error = 'Word Exceed Limit:';
			}
			alert(check_error + limit);
		 	ttext.focus();	
			return false;
		}
	}
	else
		alert("No Object Specific.");
	return true;
}

function filecheck_win(TForm)
{
        if (TForm)
        {
        	f_Win = window.open("","FWindow","width=250,height=100,toobar=no, status=no, scrollbars=yes, resizable=yes, menubar=no");
        	TForm.target = "FWindow";
        	TForm.submit();
        }
        else
        	alert("No Form Specific.");
}

function photo_win(href)
{
        if ((href == '') || (href == '#'))
		return;
	p_Win = window.open(href,"PWindow","width=750,height=600,toobar=no, status=no, scrollbars=yes, resizable=yes, menubar=no");
}

function words_count_check()
{
	for (var i=0; i< words_count_check.arguments.length; i++)
	{
		var var_1= words_count_check.arguments[i];
                var var_2= words_count_check.arguments[i+1];
                
		if (word_count(var_1, var_2, '') == false)
			return false;
		i++;
	}
	return true;
}

