//==========================================================================================
window.onload= function(){
	//formating the input form objects
	var inputs=document.getElementsByTagName("input");
	for (i=0; i<inputs.length; i++) {
		var inputType = inputs[i].type.toLowerCase();
		if (inputType == "button" || inputType == "submit") {
			//inputs[i].onmouseover = function(){this.style.color = "#5dbbdf";}
			//inputs[i].onmouseout= function(){this.style.color = "white";}
		} else if(inputType == "text" || inputType == "file" || inputType == "password") {
			inputs[i].style.width = "95%";
			if(inputs[i].id.indexOf("TXTPassword") > -1) inputs[i].style.width = "50%";
		} else if(inputType == "checkbox" || inputType == "radio") {
			inputs[i].style.border = "none";
			inputs[i].style.backgroundColor = "transparent";
		}

	}
	//if the window is a popup, remove the top navigation and the welcome message
	if (window.name == "PopupWindow") {
		document.getElementById("menu1").style.display = "none";
		document.getElementById("WelcomeDiv").style.display = "none";
	}
}
//==========================================================================================
/*
function getPixelWidth(sStr) {
//	document.body.innerHTML += "<div id='hdiv' style='position:absolute;visibility:hidden;'></div>";
	obj = document.hdiv;
	obj.document.write(sStr);
	obj.document.close();
	return (document.all)?obj.offsetWidth:obj.document.width;
}
*/
//==========================================================================================
function confirmation(message, url) {
	var answer = confirm(message);
	if (answer) {
		window.location = url;
	} else {
	}
}
//==========================================================================================
function toggle(srcElement, srcArrow) {
	if (srcElement.style.display == "none") {
		srcElement.style.display = "";
		srcArrow.src = "img/icon_expand.gif";
	} else {
		srcElement.style.display = "none"
		srcArrow.src = "img/icon_collapse.gif";
	}
}
//==========================================================================================
var myWin = null;
var myPictWin = null;

function OpenPicture(picture){
	var inside = "";
	inside += "<html>";
	inside += "<style type='text/css'><!-- body { overflow:auto; background-color:#FFFFFF; margin:0px 0px 0px 0px; padding:0px 0px 0px 0px; } --></style>";
	inside += "<body><div align=center>";
	inside += "<a href=# onclick='self.close()'>";
	inside += "<img src=" + picture + " border='0' name='picture' alt='Please Wait then Click to Close the Window!' ";
	inside += "onload='window.focus(); window.resizeTo(document.picture.width+30, document.picture.height+80); //self.moveTo(0,0);'>";
	inside += "</a>";
	inside += "</div></body>";
	inside += "</html>";
	
	if (myPictWin) myPictWin.close();
	myPictWin = window.open("", "PicturePopupWindow", "width=200,height=30, scrollbars=yes, resizable=yes");
	myPictWin.document.writeln(inside);
	myPictWin.focus();
}

function openWindow(target, windowWidth, windowHeight){
	if (myWin) myWin.close();
	myWin = window.open(target, "PopupWindow","toolbar=no, status=no, scrollbars=yes, resizable=yes, width="+windowWidth+", height="+windowHeight+"");
	myWin.focus();
}
//==========================================================================================
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//==========================================================================================