function nothing() {
	return;
}

function CheckAll(obj) { 
	var form_obj = obj.form
	for (i = 0;i < form_obj.length;i++ )	{
		if (form_obj.elements[i].type == "checkbox") { 
			form_obj.elements[i].checked = (obj.checked) ? true : false; 
		}
	}
	return;
}

function ShowD(t)
{
	var currStyle = document.getElementById(t).style.display; var cact;
	if ( currStyle == 'block' ) { cact = 'none'; } else { cact = 'block'; }
	document.getElementById(t).style.display = cact;
	return;
}

function ShowAct(t,veids) {
	var currStyle = document.getElementById(t).style.display; var cact;
	if ( veids == '0' ) { cact = 'none'; } else { cact = 'block'; }
	document.getElementById(t).style.display = cact;
	return;
}

function SetHTML(t,b) {
document.getElementById(t).innerHTML=b;
return;
}

function GetVal(t) {
return document.getElementById(t).value;
return;
}

function GetValByName(t) {
return document.getElementsByName(t)[0].value;
return;
}

function locate(u) {
window.location.href=u;
return;
}

function WinClose() {
window.close();
}

function RefreshCurrentPage() {
	var href = window.location.href;
	window.location.assign(href);
}

function RefreshOpenerPage() {
	var href = window.opener.location.href;
	window.opener.location.assign(href);
}

function hidediv(pass) {
var divs = document.getElementsByTagName('div');

	for(i=0;i<divs.length;i++){
		if(divs[i].id.match(pass)){
			if (document.getElementById) // DOM3 = IE5, NS6
			divs[i].style.display="none";// show/hide
		else
			if (document.layers) // Netscape 4
			document.layers[divs[i]].display = 'none';
			else // IE 4
			document.all.hideShow.divs[i].display = 'none';
		}
	}
return;
}

function showdiv(pass) {
var divs = document.getElementsByTagName('div');

	for(i=0;i<divs.length;i++){
		if(divs[i].id.match(pass)){
			if (document.getElementById) // DOM3 = IE5, NS6
			divs[i].style.display="block";// show/hide
		else
			if (document.layers) // Netscape 4
			document.layers[divs[i]].display = 'block';
			else // IE 4
			document.all.hideShow.divs[i].display = 'block';
		}
	}
return;
}

function openWin(page, i, width, height) {
	window.name = "main";
	if(!width) width=488;
	if(!height) height=270;
	Win=this.open(page, 'win'+i, "toolbar=no,scrollbars=yes,resizable=no,status=yes,height="+height+",width="+width);
	if (Win) Win.focus();
	return;
}

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

function nereidFade(object, destOp, rate, delta) {
    if (!document.all)
      return
    if (object != "[object]") {
      setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
      return;
    }
    clearTimeout(nereidFadeTimers[object.sourceIndex]);
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp) {
      direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;
    if (object.filters.alpha.opacity != destOp) {
      nereidFadeObjects[object.sourceIndex]=object;
      nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}

function echeck(str) {

var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){ return false; }
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false; }
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false; }
if (str.indexOf(at,(lat+1))!=-1){ return false; }
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false; }
if (str.indexOf(dot,(lat+2))==-1){ return false; }
if (str.indexOf(" ")!=-1){ return false; }
return true					
}

function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}


function updateTimeIndex() {
var st = document.getElementsByName("ddlStartTime")[0]
var et = document.getElementsByName("ddlEndTime")[0]
if (st.selectedIndex<84) {
et.selectedIndex=(st.selectedIndex + 12)
} else {
et.selectedIndex=(st.selectedIndex-84)
}
return false;
}

function refresh() {
window.location.reload(false);
return;
}

function ClassName(id,cl) {
document.getElementById(id).className=cl;
return;
}

function SetBody(id,b) {
document.getElementById(id).innerHTML=b;
return;
}

function ub(){getdim = getPageSizeWithScroll();y=getdim[1]; if (document.getElementById('pb')) { document.getElementById('pb').style.height=y+"px"; } return; }

function getPageSizeWithScroll(){
if (window.innerHeight && window.scrollMaxY) {
	yWithScroll = window.innerHeight + window.scrollMaxY;
	xWithScroll = window.innerWidth + window.scrollMaxX;
} else if (document.body.scrollHeight > document.body.offsetHeight){
	yWithScroll = document.body.scrollHeight;
	xWithScroll = document.body.scrollWidth;
} else {
	yWithScroll = document.body.offsetHeight;
	xWithScroll = document.body.offsetWidth;
}
arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
return arrayPageSizeWithScroll;
}

function GetInnerDimensions() {
	if (window.innerHeight) {
		win_y = window.innerHeight;
		win_x = window.innerWidth;
	} else {
		win_y = ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight )
		win_x = ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth )
	}
	return Array(win_x,win_y);
}

window.onresize = function() { ub(); return; }


function alpha(e) {
	var k;
	document.all ? k = e.keyCode : k = e.which;
	return ((k > 47 && k <= 57) || k == 43 || k == 8 || k == 0);
}

function IsNumeric(sText) {
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++) { 
	Char = sText.charAt(i); 
	if (ValidChars.indexOf(Char) == -1){ IsNumber = false; }
}
return IsNumber;
}

function changeTravelDayType(t,id) {
t=parseInt(t);
if (t==-1){ ShowAct(id,1); } else { ShowAct(id,0); }
return;
}

function TravelCalculation(i) {
t1=document.getElementsByName('tc1')[0].value;
t2=document.getElementsByName('tc2')[0].value;
t3=document.getElementsByName('tc3')[0].value;
t4=document.getElementsByName('tc4')[0].value;
t5=document.getElementsByName('tc5')[0].value;
t6=document.getElementsByName('tc6')[0].value;
t7=document.getElementsByName('tc7')[0].value;
//if (document.getElementsByName('tc7')[0].checked==true) { t7=1; } else { t7=0; }
url='/site/sw/calc1/result.php?t1='+t1+'&t2='+t2+'&t3='+t3+'&t4='+t4+'&t5='+t5+'&t6='+t6+'&t7='+t7;
GetUrl(url,i);
return;
}

var checkboxstarted=0;
function ChkBoxStatus(v1,v2) {
if (checkboxstarted==0) {
	checkboxstarted=1;
	v=document.getElementsByName(v1)[0].checked;
	document.getElementsByName(v2)[0].checked=v;
}
checkboxstarted=0;
return;
}

function insurch(i) {

t1=document.getElementsByName('nc1')[0];
t2=document.getElementsByName('nc2')[0];
t3=document.getElementsByName('nc3')[0];
t6=document.getElementsByName('nc6')[0];
t7=document.getElementsByName('nc7')[0];

if (document.getElementsByName('nc4')[0].checked==true) { t4=1; } else { t4=0; }
if (document.getElementsByName('nc5')[0].checked==true) { t5=1; } else { t5=0; }

p1=parseInt(t1.value);
p2=parseInt(t2.value);
p3=parseInt(t3.value);
p6=parseInt(t6.value);
p7=parseInt(t7.value);

if (p3>p2) {t3.value=t2.value; p3=t2.value;}
if (p2>p1) {t2.value=t1.value; p2=t1.value;}
if (p3>p2) {t3.value=t2.value; p3=t2.value;}
if (p2>p1) {t2.value=t1.value; p2=t1.value;}
if (p3==0) {
	document.getElementsByName('nc4')[0].checked=false;
	document.getElementsByName('nc5')[0].checked=false;
}

url='/site/sw/calc2/result.php?t1='+p1+'&t2='+p2+'&t3='+p3+'&t4='+t4+'&t5='+t5+'&t6='+p6+'&t7='+p7;
GetUrl(url,i);
return;
}

function ChkMaxVal(id,v,v2) {
if (v<v2) document.getElementsByName(id)[0].value=v;
}