
// Set Object Handlers 
// TF stands for Tickets Form

var oTF_FullName	= document.getElementById('tf_fullname');
var oTF_Email 		= document.getElementById('tf_email');
var oTF_Phone 		= document.getElementById('tf_phone');
var oTF_Country		= document.getElementById('tf_country');
var oTF_Note 		= document.getElementById('tf_note');
var oTF_Submit 		= document.getElementById('tf_submit');


// Set err Object notifiers //
// EN stands for Error Notifier;

var oEN	= document.getElementById('error_notifier');


if(oTF_Submit)
{
	// Attache Event //
	
	if(window.addEventListener)
	{
		// mozilla
		oTF_Submit.addEventListener("click",TF_validate_form,false);	
	}
	else
	{
		// IE
		oTF_Submit.attachEvent("onclick",TF_validate_form);
	}
	
}


function showErrorMessage(sMsg,oMsgDiv)
{
	if(oMsgDiv)
	{
		oMsgDiv.innerHTML = sMsg;
		oMsgDiv.style.display = 'block';
		oMsgDiv.style.width = '80%';
	}	
}


function TF_validate_form()
{
	if(!oTF_FullName.value.length)
	{		
		showErrorMessage(oUIMessage_1021,oEN);		
		document.location.hash = "LNKSa9b7ba70783b617e9998dc4dd82eb3c5";
		oTF_FullName.focus();
		return;
	}
	
	
	if(!oTF_Email.value.length)
	{
		showErrorMessage(oUIMessage_1044,oEN);	
		document.location.hash = "LNKSa9b7ba70783b617e9998dc4dd82eb3c5";		
		oTF_Email.focus();
		return;
	}
	
	if(oTF_Email.value.length < 5)
	{
		showErrorMessage(oUIMessage_1018,oEN);		
		document.location.hash = "LNKSa9b7ba70783b617e9998dc4dd82eb3c5";			
		oTF_Email.focus();
		return;
	}
		
	if(oTF_Email.value.indexOf('@') == -1)
	{	
		showErrorMessage(oUIMessage_1018,oEN);			
		document.location.hash = "LNKSa9b7ba70783b617e9998dc4dd82eb3c5";
		oTF_Email.focus();
		return;	
	}

	
	if(oTF_Email.value.indexOf('.') == -1)
	{	
		showErrorMessage(oUIMessage_1018,oEN);					
		document.location.hash = "LNKSa9b7ba70783b617e9998dc4dd82eb3c5";
		oTF_Email.focus();
		return;	
	}
	
	
	
	if(!oTF_Phone.value.length)
	{
		showErrorMessage(oUIMessage_1019,oEN);				
		document.location.hash = "LNKSa9b7ba70783b617e9998dc4dd82eb3c5";
		oTF_Phone.focus();
		return;
	}
	

	if(!oTF_Country.selectedIndex)
	{
		showErrorMessage(oUIMessage_1003,oEN);				
		document.location.hash = "LNKSa9b7ba70783b617e9998dc4dd82eb3c5";
		oTF_Country.focus();
		return;
	}
	
	var oForm = document.tf;
	if(oForm)
	{
		oForm.action = "ex/";
		oForm.method = "post";
		oForm.submit();
		
		return true;
	}
	
	else
	{
		return false;
	}
}
