// JavaScript Document

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];}}
}

String.prototype.trim = function() {
	return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,"");
};

String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}

String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

function rmObj(myObj){
	if(myObj.hasChildNodes()){
		for(var i = 0;i < myObj.childNodes.length;i++){
			rmObj(myObj.childNodes[i]);
		}
	}
	myObj.parentNode.removeChild(myObj);
}

function preload_images(){
//	MM_preloadImages();
}

function focusField(inputBox, txtDefault){
	if(inputBox.value == txtDefault){
		inputBox.value = "";	
	}
}

function blurField(inputBox, txtDefault){
	if(inputBox.value == ""){
		inputBox.value = txtDefault;	
	}		
}

function focusPassword(inputBox, txtDefault){
	if(inputBox.value == ""){
		inputBox.parentNode.getElementsByTagName("INPUT")[0].value = "";	
	}
}

function blurPassword(inputBox, txtDefault){
	if(inputBox.value == ""){
		inputBox.parentNode.getElementsByTagName("INPUT")[0].value = txtDefault;	
	}		
}

function showPopUp(o){
	var div = document.createElement("DIV");
	div.style.width = "100%";
	div.style.height = "900px";
	div.style.position = "absolute";
	div.style.top = "0px";
	div.style.left = "0px";
	div.id = "popup_framework";
	
	var bg = document.createElement("DIV");
	bg.style.width = "100%";
	bg.style.height = "900px";
	bg.style.position = "absolute";
	bg.style.top = "0px";
	bg.style.left = "0px";
	bg.style.backgroundColor = "#052847";
	bg.style.opacity="0.65";
	bg.style.filter="alpha(opacity=65)";

	div.appendChild(bg);
	
	var table = document.createElement("TABLE");
	table.style.width = "100%";
	table.style.height = "100%";
	table.border = 0;
	table.cellPadding = 0;
	table.cellSpacing = 0;
	table.style.position = "absolute";
	if(window.innerHeight){
		table.style.display = "table";
	}
	else{
		table.style.display = "block";	
	}
	table.style.top = "0";
	table.style.left = "0";

	div.appendChild(table);
	
	var tr = document.createElement("TR");
	tr.style.width = "100%";
	tr.style.height = "100%";

	table.appendChild(tr);
	
	var td = document.createElement("TD");
	td.style.width = "100%";
	td.style.height = "100%";
	td.vAlign = "middle";
	td.style.textAlign = "center";

	tr.appendChild(td);
	
	td.appendChild(o);
	
	document.getElementsByTagName("BODY")[0].appendChild(div);
	if(!window.innerHeight){
//		document.getElementsByTagName("BODY")[0].innerHTML = document.getElementsByTagName("BODY")[0].innerHTML;
		document.getElementById("popup_framework").innerHTML = document.getElementById("popup_framework").innerHTML;
	}

	var objEmbeds = document.getElementsByTagName("EMBED");
	for(var i=0; i < objEmbeds.length; i++){
		for(var j=0; j<objEmbeds[i].attributes.length; j++){
			if(objEmbeds[i].attributes[j].name == "wmode"){
				objEmbeds[i].attributes[j].value = "transparent";
			}
		}
	}

//	document.getElementsByTagName("HTML")[0].style.overflow = "hidden";
	if(window.innerHeight){
//		document.getElementsByTagName("BODY")[0].style.overflow = "hidden";
	}
	window.scrollTo(0,0);
}

function closePopup(){
	var divs = document.getElementsByTagName("DIV");
	for(var i=0;i < divs.length;i++){
		if(divs[i].className == "delete_popup"){
			divs[i].style.display = "none";
		}
	}
	
	rmObj(document.getElementById("popup_framework"));
	
//	document.getElementsByTagName("HTML")[0].style.overflow = "auto";
	if(window.innerHeight){
//		document.getElementsByTagName("BODY")[0].style.overflow = "auto";
	}
	
	var objEmbeds = document.getElementsByTagName("EMBED");
	for(var i=0; i < objEmbeds.length; i++){
		for(var j=0; j<objEmbeds[i].attributes.length; j++){
			if(objEmbeds[i].attributes[j].name == "wmode"){
//				objEmbeds[i].attributes[j].value = "window";
			}
		}
	}	
}