function popitup(url,w,h,scroll){
	var count= 0;
	count=window.history.length;
	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=yes,resizable';
  if(count<2){
  	var newwindow = null;
  	newwindow=window.open(url,'name',settings);
  	if(window.focus){
      newwindow.focus();
    }
    return false;
  }
  else{}
}
function loginNow(opt){
	var dc=window.document.ssoform;
  var opt = dc.manage.value;
//  alert(opt);
	if(opt== "option1"){
		dc.USERID.value = dc.UserID.value;
		dc.PWD.value = dc.Password.value;
		dc.TARGET.value = dc.DestPage.value;
		dc.submit();
  }
	if(opt== "option2"){
		dc.USERID.value = dc.UserID.value;
		dc.PWD.value = dc.Password.value;
		dc.TARGET.value = "https://www209.americanexpress.com/oms/global/authreg_home.do?ssolang=en_IN&ssobrand=SEWOLINT&mkt=IND";
		dc.action = "https://sso.americanexpress.com/SSO/logon.fcc";
		dc.submit();
  }
	if(opt== "option3"){
		dc.USERID.value = dc.UserID.value;
		dc.PWD.value = dc.Password.value;
    dc.TARGET.value = 'https://sso.americanexpress.com/SSO/request?request_type=auth_ssopush&ssobrand=ATWORK&ssolang=en_JP&SSOURL=http://www.americanexpress.co.in/atwork&ssoremove=yes&ssobrand=ATWORK&ssolang=en_JP';
		dc.action = "https://sso.americanexpress.com/SSO/logon.fcc";
		dc.submit();
  }
}
function validateform() {
	var optionValue;	
	var userID = document.getElementById('username').value;
	var pwd = document.getElementById('password').value;
	optionValue = document.getElementById('accountSelector').options[document.getElementById('accountSelector').selectedIndex].value;
	if (((userID =="" |  pwd=="") | (userID =="User ID" |  pwd=="Password")) & optionValue !="" ) {
		alert('Please complete both the "User ID" and "Password" fields in order to Log in.');
		return false;
	}
	else if ((userID =="" | pwd=="") & optionValue =="") {
		alert('Please complete both the "User ID" and "Password" fields and select a service in order to Log In.');
		return false;
	}
	else if ((userID =="" | userID=="User ID") & (pwd=="" | pwd=="Password") & optionValue =="") {
		alert('Please complete both the "User ID" and "Password" fields and select a service in order to Log In.');
		return false;
	}
	else if (userID.length < 4) {
		alert('The User ID or password you entered is invalid.');
		return false;
	}
	else if ((pwd.length < 5)) {
		alert('The User ID or password you entered is invalid.');
		return false;
	}
	else{
    loginNow(optionValue);
	}
}