function clearIdField() {
	var x = document.getElementById("userId");
	if(x.value == "Your ID") {
		x.value = "";
	}
}

function clearPinField() {
	var x = document.getElementById("userPin");
	if(x.value == "Your PIN Number") {
		x.value = "";
	}
}

function rollover(id, path) {
	document.getElementById(id).src = path;	
}

function shiftOpacity(backid,id, millisec) {
		//opacity(id, 0, 100, millisec);
		document.getElementById(id).style.display = "block";
		document.getElementById(backid).style.display = "block";
		document.getElementById(backid).style.zIndex = 4;
		document.getElementById(id).style.zIndex = 5000;
}

function clearOpacity(backid,id) {
		//opacity(id, 100, 0, millisec);
		document.getElementById(backid).style.display = "none";
		document.getElementById(id).style.display = "none";
}

function changeStatusBox(backid, id, linkId, changeState) {
		document.getElementById(backid).style.display = "none";
		document.getElementById(id).style.display = "none";
		if(changeState == "yes") {
				document.getElementById(linkId).innerHTML = "Completed";
				document.getElementById(linkId).style.color = "#cccccc";
		} else {
				document.getElementById(linkId).innerHTML = "Needed";
				document.getElementById(linkId).style.color = "#33CC66";
		}
}

function changeStatusBoxE(backid, id, linkId, changeState) {
		document.getElementById(backid).style.display = "none";
		document.getElementById(id).style.display = "none";
		if(changeState == "yes") {
				document.getElementById(linkId).innerHTML = "Signed";
				document.getElementById(linkId).style.color = "#cccccc";
		} else {
				document.getElementById(linkId).innerHTML = "Unsigned";
				document.getElementById(linkId).style.color = "#33CC66";
		}
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function contactUs() {
	document.forms[0].action = './ContactUs.do';
	document.forms[0].submit();
}

function showDoc(index) {
	document.forms[0].action = './ShowDocument';
	document.forms[0].index.value = index;
	document.forms[0].submit();
}

function changeStatus(status, index) {
	document.forms[0].action = './UpdateSatus.do';
	document.forms[0].index.value = index;
	document.forms[0].status.value = status;
	document.forms[0].submit();
}

function preloader() {
	image01 = new Image(); 
	image01.src = "../img/statusChangeBackground.gif";
	//image01.onLoad = alert("source = " + image01.src);
}

function showShippingLabel() {
	window.open("./GenerateShippingLabel.do","mychild","status=1,toolbar=1,location=0,menubar=1,directories=0,resizable=1,scrollbars=1,height=600,width=800");
}

function showOptions(index) {
  	var winLeft = (screen.width - 800) / 2;
  	var winTop = (screen.height - 600) / 2;
	window.open("./ShowOptionsWindow.do?idx=" + index,"optionchild","status=1,toolbar=1,location=0,menubar=1,directories=0,resizable=1,scrollbars=1,top=" + winTop + ",left=" + winLeft + ",height=600,width=800");
}

function reload(index) {
	document.forms[0].action = './ReloadDocuments.do';
	document.forms[0].index.value = index;
	document.forms[0].submit();
}

function PrintMe() {
	window.print();
}
