//JAVASCRIPT FILE
	   	   
/**********************************
	  ** FORM VALIDATION **
 *********************************/

	var fvalid_form = new FValidate("frm_mail_send");
	fvalid_form.add_check("txt_name",	"    Name",		["trim", "min1","max50"]);
	fvalid_form.add_check("txt_email",	"    E-mail",	["trim", "email","max45"]);
	fvalid_form.add_check("txt_phone",	"    Phone",	["trim", "min1","max50"]);
		
/*********************************/
function form_submit(obj) {
	if( fvalid_form.check(obj) ) {
	var check = 0;	
	for( ii=1; ii<=4; ii++)
	if( check == 0 && document.getElementById("radio"+ii).checked == true )	check = 1;
	if( check == 0 ) alert("You forgot to check any option:\n\nThis is a required option. Please select it now.")
	else document.frm_mail_send.submit();
	}return false;
 }
function file_check(){
	var file_ch	= document.frm_mail_send.the_file.value;
	if(file_ch == "") alert("Please select any file.");	else{
	var mytool_array	=	file_ch.split("\\");
	var org_name		=	mytool_array[(mytool_array.length)-1];	
	document.getElementById("span_the_attatch").innerHTML 	= "";
	document.getElementById("span_remove").innerHTML   		= "<span style='text-align:left'><a href='#' onclick='javascript:file_remove()'>remove</a></span>";
 }	}
function file_remove(){
	document.getElementById("span_the_file").innerHTML 		= '<input type="file" name="the_file" id="the_file">';
	document.getElementById("span_the_attatch").innerHTML 	= '<input type="button" name="attatch" id="attatch" value="Attatch" class="BUTTON" onclick="javascript:file_check();" />';
	document.getElementById("span_remove").innerHTML   		= '';
}
