// correctly handle PNG transparency in Win IE 5.5 or higher.
function correctPNG() 
{
	for(var i=0; i<document.images.length; i++) {
		var img = document.images[i];
		var imgName = img.src.toUpperCase();
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
			var imgID = (img.id) ? "id='" + img.id + "' " : "";
			var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			var imgStyle = "display:inline-block;" + img.style.cssText;
			if (img.align == "left") imgStyle = "float:left;" + imgStyle;
			if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
			var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
			img.outerHTML = strNewHTML;
			i = i-1;
		}
	}
}

if (window.attachEvent) {
	window.attachEvent("onload", correctPNG);
}

function RemoveContent(d) 
{
	document.getElementById(d).style.display = "none";
}

function InsertContent(d) {
	document.getElementById(d).style.display = "";
}

function AxelRef_Blur(self,blur,value,bg_empty,bg_full) 
{
    var bg_empty = (bg_empty == 0) ? '#FFFFFF' : bg_empty;
    var bg_full = (bg_full == 0) ? '#1F4651' : bg_full;

	if (blur) {
		if (self.value=='') {
			self.value=value;
			self.style.color='#AAAAAA';
		}
		self.style.backgroundColor=bg_empty;
	} else {
		if (self.value==value) {
			self.value='';
			self.style.color='#1F4651';
		}
		self.style.backgroundColor=bg_full;
	}
}

function AxelRef_Display(targetId,value) 
{
	if (document.getElementById) {
		target=document.getElementById(targetId);
		target.style.display=value;
		return true;
	}
	return false;
}

function AxelRef_ToggleDisplay(targetId) 
{
	if (document.getElementById) {
		target=document.getElementById(targetId);
		if (target.style.display=="none") {
			target.style.display="";
		} else {
			target.style.display="none";
		}
		return true;
	}
	return false;
}

function AxelRef_PopupShow(targetId,targetFrame) 
{
	if (document.getElementById) {
		if (target=document.getElementById(targetId)) {
			window.open(target.options[target.selectedIndex].value,targetFrame);
		}
	}
}

function AxelRef_Focus(targetId) 
{
	if (document.getElementById) {
		if (target=document.getElementById(targetId)) {
			target.focus();
		}
	}
}

function AxelRef_Filename(sourceElement,targetId) 
{
//		alert('hi');
	if (value = sourceElement.value) {
		//alert(value);
		if (document.getElementById) {
			if (target=document.getElementById(targetId)) {
				var file_leaf = /[\/\\]([^\/\\]*)$/
				var result=value.match(file_leaf);
				target.value=result[1];
				//alert(target.value);
				//sourceElement.reset();
				delete sourceElement;
			}
		}
	}
}

function AxelRef_Submit(formId,targetId,value) 
{
	if (document.getElementById) {
		if (targetId && value) {
			if (target=document.getElementById(targetId)) {
				target.value=value;
			}
		}
		if (form=document.getElementById(formId)) {
			 form.submit();
		}
	}
}

