function BlockEnter(e)
{
	var allSpans=document.getElementsByTagName("span");
	for(i=0;i<allSpans.length;i++)
	{
		if (allSpans[i].id.indexOf("rcLabel")!=-1)
		{
			return true;
		}
	}
	if(event.keyCode==13) return false;
}

function BrowseImage(url,w,h)
{
	window.open(url,null,"width="+w+",height="+h+",scrollbars=yes");
}

function ConfirmDelete()
{
	if(!confirm("Are you sure?"))
	{
		return false;
	}
	else
	{
		return true;
	}
}

function showPreview(tgt)
{
	if(tgt!="")
	{
		flag=0;
		prev=document.getElementById('preview');
		var img=new Image;
		img.src="file://"+tgt;
		imgg=img;
		setTimeout("ResizeImage(imgg)",100);
	}
}

function showPreviewAtPlace(tgt, place)
{
	if(tgt!="")
	{
		flag=0;
		prev=document.getElementById(place);
		var img=new Image;
		img.src="file://"+tgt;
		imgg=img;
		setTimeout("ResizeImage(imgg)",100);
	}
}

function showPreviewFileType(tgt)
{
	if(tgt!="")
	{
		flag=0;
		prev=document.getElementById('preview');
		var img=new Image;
		img.src="file://"+tgt;
		imgg=img;
		prev.src=img.src;
		//setTimeout("ResizeImage(imgg)",100);
	}
}

function ResizeImage(img)
{
	var maxH = 140;
	var maxW = 300;
	var hgt = img.height;
	var wid = img.width;
	if (hgt>maxH)
	{
		wid = maxH * wid / hgt;
		hgt = maxH;
	}
	if (wid>maxW)
	{
		hgt = maxW * hgt / wid;
		wid = maxW;
	}
	prev.height=hgt;
	prev.width=wid;
	prev.src=img.src;
}

function showImageInBox(tgt, boxWidth, boxHeight)
{
	if(tgt!="")
	{
		previewBoxWidth = boxWidth;
		previewBoxHeight = boxHeight;
		flag=0;
		prev=document.getElementById('preview');
		var img=new Image;
		img.src=tgt;
		imgg=img;
		setTimeout("FitImage(imgg)",100);
	}
}

function showPreviewInBox(tgt, boxWidth, boxHeight)
{
	if(tgt!="")
	{
		previewBoxWidth = boxWidth;
		previewBoxHeight = boxHeight;
		flag=0;
		prev=document.getElementById('preview');
		var img=new Image;
		img.src="file://"+tgt;
		imgg=img;
		setTimeout("FitImage(imgg)",100);
	}
}

function FitImage(img)
{
	var maxH = previewBoxHeight;
	var maxW = previewBoxWidth;
	var hgt = img.height;
	var wid = img.width;
	if (hgt>maxH)
	{
		wid = maxH * wid / hgt;
		hgt = maxH;
	}
	if (wid>maxW)
	{
		hgt = maxW * hgt / wid;
		wid = maxW;
	}
	prev.height=hgt;
	prev.width=wid;
	prev.src=img.src;
}

/*
function showTitle(_title)
{
	lbl_section.innerHTML=_title;
}

function restoreTitle()
{
	lbl_section.innerHTML=rest_text;
}
*/
function testX(obj) {
	if (obj.offsetParent) {
		a=obj.offsetLeft+testX(obj.offsetParent);
	}
	else 
	{
		a=obj.offsetLeft;
	}
	
	return a;
}

function testY(obj) {
	if (obj.offsetParent) {
		a=obj.offsetTop+testY(obj.offsetParent);
	}
	else 
	{
		a=obj.offsetTop;
	}
	
	return a;
}

function showPopup(div_obj,objID)
{
	x=MM_findObj(div_obj);
	if(x)
	{
		obj=document.getElementById(objID);
		posLayer(div_obj,obj);
		div_objj=div_obj;
		setTimeout("MM_showHideLayers(div_objj,'','show')",50);
	}
}

function posLayer(LayerID,obj) {
	thisLayer = document.getElementById(LayerID);
	if (thisLayer)
	{
		delta=0;
		if (!document.all) {
			delta=6;
		}
		document.getElementById(LayerID).style.left=testX(obj)+delta+14+"px";
		document.getElementById(LayerID).style.top=12+testY(obj)+"px";
	}
}

function hideLayers() {
	var allLayers=document.getElementsByTagName("div");
	for(i=0;i<allLayers.length;i++)
	{
		if (allLayers[i].id.indexOf("div_")!=-1)
		{
			allLayers[i].style.visibility="hidden";
		}
	}
}

function divPopupOverOut(elem, uniqueId, action)
{
	var bg,cl;
	if(action=='over')
	{
		bg='#F75B1F';
		cl='header';
	}
	else if(action=='out')
	{
		bg='#dcdcdc';
		cl='popupheader';
	}
	elem.bgColor=bg;
	uEl = document.getElementById(uniqueId);
	if(uEl)	uEl.className=cl;
	
}
