Ext.QuickTips.init();

function clearFormContact() {
	document.getElementById('inputan-n').value = '';
	document.getElementById('inputan-e').value = '';
	document.getElementById('inputan-s').value = '';
	document.getElementById('inputan-c').value = '';
	document.getElementById('inputan-code').value = '';
}

function sendMail() {
	Ext.get('loadingemail').mask('Sedang mengirim data...'); 
	Ext.Ajax.request({
		url: '/web/contact/mail-contact.php',
		params: {
			task: 'sendmail',
			nama: document.getElementById('inputan-n').value,
			email: document.getElementById('inputan-e').value,
			subject: document.getElementById('inputan-s').value,
			content: document.getElementById('inputan-c').value,
			code: document.getElementById('inputan-code').value
		},
		callback: function(o,p,r) {
			switch(r.responseText) {
				case '1':
					Ext.Msg.alert('Perhatian', 'Pesan telah terkirim. Terima kasih telah menghubungi kami!');
					document.getElementById('siimage').src = 'web/contact/securimage_show.php?sid=' + Math.random();
					break;
				case '2':
					Ext.Msg.alert('Perhatian', 'Maaf pesan Anda tidak terkirim karena adanya gangguan pada server kami. Silakan coba lagi nanti!');
					document.getElementById('siimage').src = 'web/contact/securimage_show.php?sid=' + Math.random();
					break;
				case '3':
					Ext.Msg.show({
						title:'Save Changes?',
						msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
						buttons: Ext.Msg.YESNOCANCEL,
						animEl: Ext.getBody(),
						icon: Ext.MessageBox.QUESTION

					});
					break;
			}
			Ext.get('loadingemail').unmask();
			clearFormContact();
		}
	});
}

function goListnews() {
	Ext.History.add('goListnews');
}

function goListnews2() {
	document.getElementById('homecontainer').style.display = 'none';
	document.getElementById('homecontainerini').style.display = 'none';
	document.getElementById('portfoliocontainer').style.display = 'none';
	document.getElementById('contactcontainer').style.display = 'none';
	document.getElementById('albumshow').style.display = 'none';
	document.getElementById('lookingfornews').style.display = 'none';
	Ext.get('listnews').fadeIn();
}
