/*********************************
24/04/2008  OngKL  Login Checking
20/05/2008  OngKL  Add bliking text Blink()
xx/xx/2008  Sam    add redirect
29/01/2009  OngKL  add on enter to submit the form
04/05/2009  OngKL  Change the redirect path from vttv.tv to iexpress.com.my
**********************************/
// Login checking
function checkEmptyLogin(field, field2, strFocus) {
  if(field!="" && strFocus=="") {
		return field2;
	} else if (field2!=strFocus) {
	  return strFocus;
	}
}

function submitLoginForm() {
  var f = document.frmLogin;
	var message = "";
	var toFocus = "";
  if (f.fuserName.value=="") {
    message = "- Username.<br>";
		//alert("here");
    toFocus = checkEmptyLogin(message,"fuserName",toFocus);
		//alert("toFocus:"+toFocus);
	  //alert("Please fill up the Username.");
		//f.fuserName.focus();
		//return false;
	}
  if (f.fpass.value=="") {
    message += "- Password.<br>";
		//alert("2.toFocus:"+toFocus);
    toFocus = checkEmptyLogin(message,"fpass",toFocus);
		//alert("2.1toFocus:"+toFocus);
    //alert("Please fill up the Password.");
		//f.fpass.focus();
		//return false;
	}
	if (f.fpass.value!="" && f.fpass.value.length<6 ) {
    message += "- Password. (minimum 6 to 12 characters)<br>";
    toFocus = checkEmptyLogin(message,"fpass",toFocus);
    //alert("Please fill up the Password with minimum 6 to 12 characters.");
		//f.fpass.focus();
		//f.fpass.select();
		//return false;
	}
//alert(toFocus);
//alert(message);
	if (message!="") {
	  message = "Please fill in : -<br>"+message;
	  loginMsg.innerHTML = "<br>"+message+"<br>";
		eval("f."+toFocus+".focus()");
		return false;
	}
  //f.fsubmit.disabled = "true";
  //f.freset.disabled = "true";
  f.method = "post";
  f.action = "login";
  f.submit();
}

/** add blinking text **/
<!-- Begin
window.onerror = null;
 var bName = navigator.appName;
 var bVer = parseInt(navigator.appVersion);
 var NS4 = (bName == "Netscape" && bVer >= 4);
 var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
 var NS3 = (bName == "Netscape" && bVer < 4);
 var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
 var blink_speed=1000;
 var i=0;
 
if (NS4 || IE4) {
  if (navigator.appName == "Netscape") {
    layerStyleRef="layer.";
    layerRef="document.layers";
    styleSwitch="";
  } else {
  layerStyleRef="layer.style.";
  layerRef="document.all";
  styleSwitch=".style";
  }
}

//BLINKING
function Blink(layerName){
  if (NS4 || IE4) { 
    if (i%2==0) {
      eval(layerRef+'["'+layerName+'"]'+
      styleSwitch+'.visibility="visible"');
    } else {
      eval(layerRef+'["'+layerName+'"]'+
      styleSwitch+'.visibility="hidden"');
    }
  }
  if(i<1) {
    i++;
  } else {
    i--;
  }
  setTimeout("Blink('"+layerName+"')",blink_speed);
}
//  End -->


// Redirect
var str=window.location + "";
//alert(str.slice(0,26));

if (str.slice(0,19)=="http://vttv.com.my/") {
  window.location="http://www.iexpress.com.my";
}

if (str.slice(0,23)=="http://www.vttv.com.my/") {
  window.location="http://www.iexpress.com.my";
}

if (str.slice(0,15)=="http://vttv.tv/") {
  window.location="http://www.iexpress.com.my";
}

if (str.slice(0,19)=="http://www.vttv.tv/") {
  window.location="http://www.iexpress.com.my";
}

if (str.slice(0,20)=="http://www2.vttv.tv/") {
  window.location="https://www2.vttv.tv";
}
// End -->


/** on enter check login **/
function onEnter() {
  if (window.event && window.event.keyCode == 13)
	  submitLoginForm();
}