function ShowToolTip(object) {
    document.getElementById(object).style.visibility = 'visible';
}

function HideToolTip(object) {
    document.getElementById(object).style.visibility = 'hidden';
}

function ChangeStatus(val){
	document.frmTicket.id.value = val;
	document.frmTicket.donow.value = "change_status";
	document.frmTicket.submit();
}

function SortCol(orderType,orderBy,searchStr){
	document.frmFindTicket.orderType.value = orderType;
	document.frmFindTicket.orderBy.value = orderBy;		
	document.frmFindTicket.searchStr.value = searchStr;		
	document.frmFindTicket.submit();
}

function AcceptTicket(ticket_id){
	document.frmTicket.id.value = ticket_id;
	document.frmTicket.donow.value = "accept_ticket";
	document.frmTicket.submit();
}

function CancelTicket(ticket_id){
	document.frmTicket.id.value = ticket_id;
	document.frmTicket.donow.value = "cancel_ticket";
	document.frmTicket.submit();
}


function check_newticket_form(frm)  {
	re = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)/;
	var user_name, email, question, vercode, dataRight = true;
	var message = "";
	user_name     = frm.user_name.value;
	email    = frm.email.value;
	question = frm.message.value;
	vercode = frm.vercode.value;
	if (user_name.length==0)     {
		message += "\n -  Name";
		dataRight=false;
	};
	if (email.length==0)    {
	   message += "\n -  Email";
	   dataRight=false;
	};
	if (email.length!=0 && email.match(re)==null)    {
	   dataRight=false;
	   message += "\n -  Email is not valid";
	};
	if (question.length==0)     {
		message += "\n -  Question";
		dataRight=false;
	};
	if (vercode.length==0)    {
	   message += "\n -  Verification code";
	   dataRight=false;
	};
	if (!dataRight)    {
		if (message != "")   {
		   message ="\n" +
		   "You failed to correctly fill in the form:\n" +
		   message + "\n" +
		   "\nPlease re-enter and submit it again!";
	   };
	   alert(message);
	};
	return dataRight;
};


function check_ticketid_form(frm)  {
	var ticket_id, dataRight = true;
	var message = "";
	ticket_id = frm.ticket_id.value;
	if (ticket_id.length==0)     {
		message += "\n -  Please enter ticket tracking ID";
		dataRight=false;
	};
	if (!dataRight)    {
	   alert(message);
	};
	return dataRight;
};

function check_reminder_form(frm)  {
	re = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)/;
	var email, dataRight = true;
	var message = "";
	email = frm.email.value;
	if (email.length==0)    {
	   message += "\n -  Please enter Email address";
	   dataRight=false;
	};
	if (email.length!=0 && email.match(re)==null)    {
	   dataRight=false;
	   message += "\n -  Email is not valid";
	};
	if (!dataRight)    {
	   alert(message);
	};
	return dataRight;
};


function check_reply_form(frm)  {
	var reply, dataRight = true;
	var message = "";
	reply = frm.reply.value;
	if (reply.length==0)     {
		message += "\n -  Please enter reply";
		dataRight=false;
	};
	if (!dataRight)    {
	   alert(message);
	};
	return dataRight;
};

