function doSubmit(){
    var f=document.stdform;
	var message=document.all.do_submit_msg.style;
	var cover=document.all.do_submit_cover.style;
	//center the message box, hardcode to align the position
	//alert(document.body.scrollTop+"  " +document.body.scrollLeft+" "+document.body.offsetHeight+" "+document.body.offsetWidth);
    
	message.top=(document.body.scrollTop)+(document.body.offsetHeight/2)-65;
	message.left=(document.body.scrollLeft)+(document.body.offsetWidth/2)-115;
	message.visibility='visible';

	//resize the image to cover the whole page
	//(preserve 3px to prevent page overflow)
	cover.height=document.body.scrollHeight-3;
	cover.width=document.body.scrollWidth;
	cover.visibility='visible';

	//override events to prevent further submit
	for(var i=0; i<f.length; i++){
		f.elements[i].onchange=function(){return false;};
		f.elements[i].onclick=function(){return false;};
	}

	//hidden all select menu to prevent overlap with message layer
	for(i=0;i<document.getElementsByTagName('SELECT').length;i++){
		obj=document.getElementsByTagName('SELECT')[i];
		if(!obj){
			continue;
		}	
		obj.style.visibility="hidden";
	}
	//disable all keyboard events(especially the tab key)
	document.body.onkeydown=function(){return false;};
	//show a wait cursor
	document.body.style.cursor ="wait";
	f.submit();
}

function opSubmit(op){
    document.stdform.op.value=op;
    doSubmit();
}

function popup(mylink){
    if (!window.focus)return true;
    var href;
    if (typeof(mylink) == 'string'){
       href=mylink;
    }else{
       href=mylink.href;
    }
    window.open(href,"","width=980,height=600,resizable=yes,scrollbars=yes");
    return false;
}

function getBrowserVersion(){
	var browser;
	var version;
	if(navigator.appName=='Microsoft Internet Explorer'){
		browser="IE";
		var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		if(re.exec(navigator.userAgent)!=null){
			version=parseFloat(RegExp.$1);
		}
	}
	return browser+version;
}

function closeWindow(){
	var bv=getBrowserVersion();
	if(bv=="IE6" || bv=="IE7" || bv=="IE8"){
		window.opener=null; 
	    window.open("","_self"); 
		window.close();
	}else{
		window.opener=null; 
	    window.open("","_self"); 
		window.close();
	}
}

function padZero(s){
	return (s<10)?"0"+s:s;
}