// JavaScript Document

function replaceDateToImg() {
 var strNum;
 strNum = document.getElementById("date").innerHTML;
 var strNum_length;
 strNum_length = strNum.length;
 var newhtml;
 newhtml = '';
 for( i=0; i<strNum_length; i++){
  if(strNum.substr(i,1) == "."){
   newhtml = newhtml + '<img src="/image/layout/imdex/dot_dateNum.jpg" alt=".">';
  } else {
   newhtml = newhtml + '<img src="/image/layout/imdex/' + strNum.substr(i,1) +'_dateNum.jpg" style="margin-left: 1px;" alt="' + strNum.substr(i,1) +'">';
  }
 }
 //alert(newhtml);
 document.getElementById("date").innerHTML = newhtml;
}

function noPostBack(sNewFormAction)
{
    if(document.layers) //The browser is Netscape 4
    {
        document.layers['Content'].document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
        document.layers['Content'].document.forms[0].action = sNewFormAction;
    }
    else //It is some other browser that understands the DOM
    {
        document.forms[0].action = sNewFormAction;
        document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
    }
}

function onEnterSubmit() {
    if(event.keyCode == 13){
        postlink = 'http://' & Request.Url.Host.ToLower() & '/webpac/Person.dll';
        noPostBack(postlink);
    }
}

function resizeMainDivHeight(){
		var h = (document.all) ? document.documentElement.clientHeight : window.innerHeight; //Firefox
		var h2 = (document.all) ? document.documentElement.scrollHeight : window.innerHeight + window.scrollMaxY;
		if(h == h2){
		    document.getElementById("subpageMainbox").style.height = h + "px";
		} else {
		    h = h + 140; // 140 is footer height
		    h2 = h2 + 140;
		}
		if(h>h2){
			document.getElementById("subpageMainbox").style.height = h + "px";
		} else {
			document.getElementById("subpageMainbox").style.height = h2 + "px";
		}
}