function addFooter()
{
	var Footer = "<div id='footerLine'>&nbsp;</div>" +
				"&copy; <a href='http://www.s-classinter.com/' target='_blank'>บริษัท เอส-คลาส อินเตอร์เนชั่นแนล จำกัด</a><br />" +
				"อาคารเอส-คลาส เลขที่ 1374 ถ.ประชาชื่น แขวงบางซื่อ เขตบางซื่อ กรุงเทพฯ 10800<br />" +
				"โทร. 0-2951-8557, 0-2951-7766, 0-2951-8570-1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;แฟ็กซ์. 0-2951-8556, 0-2951-7760<br />" +
				"<div class='IE6DupCharBug'>&nbsp;</div>";

	document.getElementById("footer").innerHTML = Footer;
}

function addFooting()
{
	var Footer = "&copy; <a href='http://www.s-classinter.com/' target='_blank'>บริษัท เอส-คลาส อินเตอร์เนชั่นแนล จำกัด</a><br />" +
				"อาคารเอส-คลาส เลขที่ 1374 ถ.ประชาชื่น แขวงบางซื่อ เขตบางซื่อ กรุงเทพฯ 10800<br />" +
				"โทร. 0-2951-8557, 0-2951-7766, 0-2951-8570-1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;แฟ็กซ์. 0-2951-8556, 0-2951-7760<br />" +
				"<div class='IE6DupCharBug'>&nbsp;</div>";

	document.getElementById("footing").innerHTML = Footer;
}


function q(text){	return "<q>" + text + "</q>";	}

function h1(text){	return "<h1>" + text + "</h1>";	}
function h2(text){	return "<h2>" + text + "</h2>";	}
function h3(text){	return "<h3>" + text + "</h3>";	}
function h4(text){	return "<h4>" + text + "</h4>";	}
function h5(text){	return "<h5>" + text + "</h5>";	}
function h6(text){	return "<h6>" + text + "</h6>";	}

function d(tag, text){	return "<div class='" + tag + "'>" + text + "</div>";	}
function s(tag, text){	return "<span class='" + tag + "'>" + text + "</span>";	}


function addFooterAX()
{

	var url = "footer.php";
	var ajax = new Ajax.Request(url, {
		method: 'GET',
		//encoding: 'utf-8',
		//requestHeaders: {Accept: 'application/json'},
		onSuccess: onSuccess_addFooter,
		onFailure: onFailure_addFooter 
	});
}

function onSuccess_addFooter(response)
{
	$('footer').innerHTML = response.responseText;
	//alert(response.responseText);
	
	
	//var json = response.responseText.evalJSON();
	//alert(json.Footer);
	//$('footer').innerHTML = json.Footer;
}

function onFailure_addFooter(response)
{
	alert ("Failed to add footer");
}

function getBaseUrl()
{
	var base,idx;
	
	base = window.location.toString();
	base = base.substr(7);				// remove "http://" from "http://localhost/..."
	
	idx = base.indexOf("localhost");
	if (idx == -1)		// localhost NOT found in the string
	{
		idx = base.indexOf ("/");		// get index of "/" in "domain.xxx/..."
		base = base.slice(0, idx);		// get domain.xxx from "domain.xxx/..."
		return ("http://" + base + "/");
	}
	else
	{
		base = base.substr(10);			// remove "localhost/" from "localhost/..."
		idx = base.indexOf ("/");		// get index of "/" in "domain.xxx/..."
		base = base.slice(0, idx);		// get domain.xxx from "domain.xxx/..."
		return ("http://localhost/" + base + "/");
	}
}

function showWelcomeText()
{
	$("#welcome").text("ยินดีต้อนรับสู่ บริษัท เอส-คลาส อินเตอร์เนชั่นแนล").jTypeWriter({duration:0.5, onComplete:showWelcomeText2});
}
function showWelcomeText2()
{
	$(this).oneTime (2000, function()
		{
			$("#welcome").text("คุณภาพ คุณธรรม คุณประโยชน์").jTypeWriter({duration:0.5, onComplete:showWelcomeText3});
		}
	);
}
function showWelcomeText3()
{
	$(this).oneTime (2000, function()
		{
			$("#welcome").text("สินค้าดี มีแผนง่าย ได้ช่วยคน").jTypeWriter({duration:0.5, onComplete:loopWelcome});
		}
	);
}
function loopWelcome()
{
	$(this).oneTime (2000, function()
		{
			showWelcomeText();
		}
	);
}
