var modulesList = '*';

/*
* syntax:
* loadModule ( module , params , container-id, security-code (option), donot-save-status (option) );
* getBlock(container-id, block-id);
*/

//for home
getBlock('top-for-homepage','top-for-homepage');

//slide-banner
//getBlock('slide-banner','slide-banner');

//Kontakt-banner
getBlock('Kontakt-banner','Kontakt-banner');

//Impressum-banner
getBlock('Impressum-banner','Impressum-banner');

//Archive-banner
getBlock('Archive-banner','Archive-banner');
getBlock('Angebote-banner','Angebote-banner');

//san pham
getBlock('Aktuelles-banner','Aktuelles-banner');

//top-banner
//getBlock('main-flash', 'main-flash');
//getBlock('language', 'language');

//marquee
//getBlock('marquee', 'marquee');

//left menu
getBlock('left_menu', 'left_menu');

//hotline
getBlock('hotline','hotline');

//footer
getBlock('footer', 'footer');

//online
//whoonline();
//visitor();
//getBlock('topthongtin', 'topthongtin');
//getBlock('linkthongtin', 'linkthongtin');
//loadModule('weblinkcs', 'dropdown', 'weblink', '', true);
//getBlock('chatyahoo', 'chatyahoo');

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
function setDefault(el) {
  if (trimAll(el.value)=='') el.value = el.defaultValue
}

/*
Function to check is textbox empty ?
Modifed by vu980
*/
function IsEmpty(id, msg)
{
	var obj = getContainerID(id);
	if (trimAll(obj.value)=='' || trimAll(obj.value)==obj.defaultValue)
	{
		alert(msg);
		obj.focus();
		return true;
	}
	else
	{
		return false;
	}
}

//check form contact
function check_submit_contact(lang)
{
	if (IsEmpty('name',((lang == 'vn') ? 'Xin nhập họ tên' : 'Bitte geben Sie Ihren Name ein!')))
   	{
		return false;
   	}
   	if (IsEmpty('email',((lang == 'vn') ? 'Xin nhập địa chỉ email' : 'Bitte geben Sie eine richtige E-Mail-Adresse ein!')))
   	{
	   	return false;
   	}
   	if (!IsEmail(getContainerID('email').value))
   	{
	   	if (lang == 'vn')
	   	{
	   		alert('Địa chỉ email không hợp lệ!');
	   	}
	   	else
	   	{
		   	alert('Die E-Mail-Adresse ist nicht korrekt!');
	   	}
	   	getContainerID('email').focus();
	   	return false;
   	}
   	if (IsEmpty('nachricht',((lang == 'vn') ? 'Xin nhập nội dung' : 'Bitte geben Sie eine Nachricht ein!')))
   	{
	   	return false;
   	}
   
   	//send contact
   	if (document.getElementById) 
   	{
		var e = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
	}
	
	if (e) 
	{
		getContainerID('sendingicon').style.display = '';
		e.onreadystatechange = function()
								{
									if (e.readyState == 4 && e.status == 200) 
									{
										getContainerID('sendingicon').style.display = 'none';
										if (lang == 'vn')
										{
											alert('Nội dung liên hệ của bạn đã được gởi đi.'+String.fromCharCode(13)+'Xin chân thành cảm ơn!');
										}
										else
										{
											alert('Ihre Nachricht wurde erfolgreich gesendet. Vielen Dank!');
										}
										getContainerID('name').value = 'Name*';
									   	getContainerID('email').value = 'E-mail*';
									   	getContainerID('betreff').value = 'Betreff';
									   	getContainerID('nachricht').value = 'Ihre Nachricht*';
									}
								}
		$.post("sendmail.php", { name: getContainerID('name').value, email: getContainerID('email').value, title:getContainerID('betreff').value, content:getContainerID('nachricht').value },
		  function(data){
			alert(data);
		  });
		$("img#sendingicon").ajaxStop(function(){
		   $(this).hide();
		 });
		//e.open("POST", 'sendmail.php?template=contactmailtemplate&debug=0', true);
		//e.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//e.send('name='+getContainerID('name').value+'&email='+getContainerID('email').value+'&betreff='+getContainerID('betreff').value+'&nachricht='+getContainerID('nachricht').value);						
	}
   //done send
}
