/*
Auto center window script- Eric King (http://redrival.com/eak/fsindex.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

function formrule(field)
{
	if (field.defaultValue == field.value) field.value = "";
}
function formrule2(field) {
  if (field.value == "") {
    field.value = field.defaultValue;
  }
}

function Validate(){
 var bitErr = false;
 
 if (document.contactForm.Name.value == "") bitErr = true; 
 if (document.contactForm.Email.value == "") bitErr = true; 
 if (document.contactForm.Phone.value == "") bitErr = true; 
 if (document.contactForm.Message.value == "") bitErr = true; 
 if (document.contactForm.Name.value == " address me as") bitErr = true; 
 if (document.contactForm.Email.value == " email") bitErr = true; 
 if (document.contactForm.Phone.value == " phone") bitErr = true; 
 if (document.contactForm.Message.value == " message") bitErr = true; 
 if (document.contactForm.Email.value.indexOf("@") == -1) bitErr = true;
 if (document.contactForm.Email.value.indexOf(".") == -1) bitErr = true;
 
 if (bitErr){
  alert("Please fill up all the necessary information\nand check for the correctness of your entries.\nPlease use a valid email address.");
  return false;
 }
 
 document.contactForm.submit();
}


function showhide(id){
	hide('ph');
	hide('viet');
	show(id);
}

function hide(id) {
	if (document.getElementById){
		obj = document.getElementById(id + 'tab');
		obj.style.background = "url(images/news_" + id + "_inact.gif)";

		obj = document.getElementById(id + 'content');
		obj.style.display = "none";
	}
}

function show(id) {
	if (document.getElementById){
		obj = document.getElementById(id + 'tab');
		obj.style.background = "url(images/news_" + id + "_act.gif)";

		obj = document.getElementById(id + 'content');
		obj.style.display = "";
	}
}


/*
var message="Function Disabled!";
*/
///////////////////////////////////

/*
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")
*/