function maximize() {
  window.moveTo(0, 0);
  window.resizeTo(screen.width, screen.height);
}

function changecss(id, newClass) 
{
      identity=document.getElementById(id);
      identity.className=newClass;
}

function calcHeight(id)
{
  //find the height of the internal page
  var the_height= document.getElementById(id).contentWindow.document.body.scrollHeight;

	if(the_height < 600)
	{
		the_height = 600 ;
	}

  //change the height of the iframe
  document.getElementById(id).height=the_height;
}

function max_text(input_id,countdown_id)
{
	var max_length = 300 ;
	var text = document.getElementById(input_id) ;
	
	if( text.value.length > 300)
	{
		alert('คุณป้อนคำถามเกินกว่า 300 ตัวอักษรแล้วค่ะ');
		document.getElementById(input_id).value = text.value.substring(0,max_length);
	}
	document.getElementById(countdown_id).innerHTML = 'สามารถพิมพ์ได้อีก <B>' + (max_length-document.getElementById(input_id).value.length) +'</B> ตัวอักษรค่ะ' ;
}

function calcHeight2(id)
{
  //find the height of the internal page
  var the_height= document.getElementById(id).contentWindow.document.body.scrollHeight;

	if(the_height < 50)
	{
		the_height = 50 ;
	}
	
  //change the height of the iframe
  document.getElementById(id).height=the_height;
}

function click(e) 
{
	var message="ยินดีต้อนรับสู่ เว็บไซต์ มิสเตอร์แท็กซ์บิสครับ"; 
	if (document.all) 
	{
		if (event.button == 2) 
		{
			alert(message);
			return false;
		}
	}
	if (document.layers) 
	{
		if (e.which == 3) 
		{
			alert(message);
			return false;
		}
	}
}

if (document.layers) 
{
	document.captureEvents(Event.MOUSEDOWN);
}
//document.onmousedown=click;

var xV1 = 50;
var xV2 = 0;

function stayHome(){	
	

	nV = document.body.scrollTop;	
	//alert(document.body.scrollTop );
	if(document.body.clientWidth > 1200)
	{
		document.getElementById('isFloat1').style.top = nV;
		document.getElementById('isFloat1').style.visibility = "visible";
		document.getElementById('isFloat2').style.top = nV;
		document.getElementById('isFloat2').style.visibility = "visible";

		if(nV < xV1)
		{
			document.getElementById('isFloat1').style.top = xV1-nV;
			document.getElementById('isFloat1').style.visibility = "visible";
			document.getElementById('isFloat2').style.top = xV1-nV;
			document.getElementById('isFloat2').style.visibility = "visible";
		}
	}
	else
	{
		document.getElementById('isFloat1').style.visibility = "hidden";
		document.getElementById('isFloat2').style.visibility = "hidden";
	}
	//document.getElementById('isFloat2').style.top = xV2+nV;
}

function init(){

	xV1 = document.getElementById('isFloat1').offsetTop;
	//alert(xV1);
	//xV2 = document.getElementById('isFloat2').offsetTop;
}

window.onload=init;
window.onscroll=stayHome;
window.onresize=stayHome;



